I've already got this code:
<h1 align="center" id="message" class="expandUp"></h1>
<script type="text/javascript">
var d = new Date();
var n = d.getDate();
if ( n == 1) {
message = "<img src='image1.png'></img>";
} else if ( n == 2) {
message = "<img src='image2.png'></img>";
} else if ( n == 3) {
message = "<img src='image3.png'></img>";
} else {
message = "<img src='default.png'></img>";
}
document.getElementById("message").innerHTML = message;
</script>
It displays a different image under h1 if the if/else statements are met. I wanna know how I can change in-page html code instead of displaying an image, such as disabling a specific button or hiding a div. I wonder if I should use some other function between the the if/else statements instead of message = "<img src></img>";
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire