suzie Posted March 18, 2010 Share Posted March 18, 2010 Dear,am using in my site done in php, the following javascript function (showcollapse)...In Fire Fox it works very well, but in explorer it doesn't work....(IE 8)here is the function:<script type="text/JavaScript">function showcollapse(what){a=document.getElementById(what);if (a.style.display==''){a.style.display='none';} else {a.style.display='';}}</script>and here is the call...<div class="class1"><a href="java script:showcollapse('1');">$title</a></div>and the error is in the line:a=document.getElementById(what);object doesn't support this property or methodplease any Help!!Best Regards, thank you Link to comment Share on other sites More sharing options...
Synook Posted March 18, 2010 Share Posted March 18, 2010 IDs can't start with numbers. That is the standard (Firefox is just being nice to you). Link to comment Share on other sites More sharing options...
suzie Posted March 18, 2010 Author Share Posted March 18, 2010 thank you,But I tried to replace the one by 'a', but still the same error...any suggestion please... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 18, 2010 Share Posted March 18, 2010 Are you sure it's that line and not the line after it? If you add an alert statement right after document.getElementById, do you see the alert show? Link to comment Share on other sites More sharing options...
Synook Posted March 19, 2010 Share Posted March 19, 2010 Also, you should really be declaring the a variable with the var keyword. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.