In this module I started with the code provided, “if (time<20){ document.get.ElementByld(“demo”).innerHTML = “Good day”; }
I added if else and this was final output
function myFunction() {
var time = new Date().getHours();
if (time < 20) {
document.getElementById(“demo”).innerHTML = “Good day”;
}else{
greeting = “Good Evening”;
}
document.getElementByld(“demo”).innerHTML=greeting;
}
-The code seemed to work fine once it uploaded to my website.
-I had a hard time working with PHP as the code did not work at in the Tryit editor.
The code I used –
<!DOCTYPE html>
<html>
<body>
<?php
$d=date(“D”);
if ($d==”Fri”)
echo “Have a nice weekend!”;
elseif ($d==”Sun”)
echo “Have a nice Sunday!”;
else
echo “Have a nice day!”;
?>
</body>
</html>
To me, PHP and JAvaScript are different and PHP seems to be more complex. I am excited to learn more in depth. I will be revisiting the lectures and powerpoint for my final project.
For my final project I will be creating a website with a charity in the Tampa bay area.