Wheew, long time no see. :D
I have a little js/php formatting issue in my functions.php file.
I am trying to load this one script (to refresh a webcam image every 2 seconds) but only for category ID 45 — but I have no idea about the formatting.
Here’s what I got so far:
// Load the webcam script only for category 45
function webcam_script() { if (is_category('45')) { ?>
<script type="text/javascript">
function holdUp()
{
refreshFreq=2;
setTimeout("freshPic()", refreshFreq*1000);
}
function freshPic()
{
var currentPath=document.campic.src;
var trimmedPath=new Array();
trimmedPath=currentPath.split("?");
document.campic.src = trimmedPath[0] + "?" + Math.random();
holdUp();
}
</script>
<?php } }
add_action('wp_head','webcam_script');
Plus for the script to kick in I have to add onLoad="holdUp()" to the <body> but have no idea how to do that either.
This is how it looks so far: http://ads-rantum.de/rantum-live-webcam/