Does anyone read these? I’m beginning to doubt it. Am I in the wrong area or something?
theres no magic to using js inside theme files .. you treat them the same way you would if they were straight HTML .. The only thing to watch out for is that you dont break PHP stuff, and this usually only happens unless you paste plain old HTML into a PHP function.
If you want help, beyond that, then you need to show us where you are putting the javascript. Looking at your site doesnt help.
Paste the edits you are making to header.php
First, thanks for the response.
What am I putting in the header? I think that’s where I’m lost. I’m not sure what to put in my header file – what the proper syntax is to call the script into the place of the header image. I know I’ll have to modify the style.css header class also since it already sets up the single static image. I currently have this script but I’m just not sure how to add it into the header:
<script type=”text/javascript”>
var current= new Date()
var x=current.getHours()
if (x>=4 && x<8) {
document.write(“<img src=’http://www.skylarkstudio.net/annieblog/wp-content/themes/babyblog-itsaboy/images/header-bg_spring_sunrise.jpg’>”)
} else
if (x>=8 && x<16) {
document.write(“<img src=’http://www.skylarkstudio.net/annieblog/wp-content/themes/babyblog-itsaboy/images/header-bg_spring_day.jpg’>”)
} else
if (x>=16 && x<20) {
document.write(“<img src=’http://www.skylarkstudio.net/annieblog/wp-content/themes/babyblog-itsaboy/images/header-bg_spring_dusk.jpg’>”)
} else
document.write(“<img src=’http://www.skylarkstudio.net/annieblog/wp-content/themes/babyblog-itsaboy/images/header-bg_spring_night.jpg’>”)
</script>
I’ve tested the script and it does exactly what I’m looking to do. Any help you can give me is greatly appreciated.
-Rob
ugggh! What’s killing me is that I know I’m close and one of you guys that can code circles around me could look at this thing and tell me exactly how to do it without blinking in between sips of your mountain dew.
Anyone?