Hello everyone, I'm a newbie to javascript, and would absolutely love if someone could help me understand why it's returning that document.getElementById("footer") is null. What I need this to do is to add the appropriate class to the element with id="footer".
This is a php document in order to render only specific javascript depending on a variable from a cookie. If you view the link to the full script below, Everything but the problem area is working.
Code:
Here is the link I'm working on: http://blog.blindmikey.comPHP Code:#Check to see if cookie has been set
if(isset($_COOKIE['isExtended']))
{
#If it has, set $isExtended var to Cookie var
$isExtended = $_COOKIE['isExtended'];
#and echo current value
echo "isExtended = $isExtended ;";
#and set element's rendered class
[COLOR="Red"]if($isExtended == 0)
{
echo "document.getElementById('footer').setProperty('class','min');";
}
else {
echo "document.getElementById('footer').setProperty('class','max');";
}[/COLOR]
}
#If it hasn't, echo default value
else
{
echo "isExtended = 1 ;";
}
And here is a direct link to the full script: http://blog.blindmikey.com/wp-conten...oterToggle.php
Thank you to anyone that can explain this to me, sad to admit, I've spent hours on this.
-mikey


Reply With Quote

Bookmarks