I want to make a background image change according by the time of day! it works perfectly when I preview locally on my computer. But it does’t work after I uploaded on my web hosting. can anyone solve my problem????
this is my javascript & html code.
[code=html]<body>
<script type=”text/javascript”>
var d = new Date()
var h = d.getHours()
//
if (h < 6) document.write(‘<style type=”text/css”>body {background:#47643a url(http://file.qooza.hk/userfile/8/1/16481/morning.jpg) repeat-x}”></style>’)
else if (h < 17) document.write(‘<style type=”text/css”>body {background:#47643a url(http://file.qooza.hk/userfile/8/1/16481/bodyNewbg.jpg) repeat-x}”></style>’)
else if (h < 20) document.write(‘<style type=”text/css”>body {background:#47643a url(http://file.qooza.hk/userfile/8/1/16481/midnight.jpg) repeat-x}”></style>’)
else if (h < 24) document.write(‘<style type=”text/css”>body {background:#47643a url(http://file.qooza.hk/userfile/8/1/16481/night.jpg) repeat-x}”></style>’)
//–>
</script>
</body>