Skip to content

Instantly share code, notes, and snippets.

@ryuichimatsumoto-single
Created January 31, 2012 13:58
Show Gist options
  • Save ryuichimatsumoto-single/1710621 to your computer and use it in GitHub Desktop.
Save ryuichimatsumoto-single/1710621 to your computer and use it in GitHub Desktop.
曜日に応じてヘッダーの画像を切り替える(changing of header per day)
<!--Changing of header start-->
<!--Sorry,Comments of this program is written in Japanese.-->
<script type="text/javascript">
<!--
today = new Date();
/*rand関数に乱数を加えてみても面白そうです。*/
var rand = today.getDay();
var headerarea = document.getElementById("header");
/*0が日曜、6が金曜をいう感じです。リンクが同じ場合は、
配列などを用いてもよさそうです。*/
if(rand == 0){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 1){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 2){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 3){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 4){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 5){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
else if(rand == 6){
headerarea.innerHTML = ('<a href=""><img src=""></a>');
}
// -->
</script>
<!--Changing of header end-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment