Jump to content

Javascript from IE


suzie
 Share

Recommended Posts

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

Edited by suzie
Link to comment
Share on other sites

IDs can't start with numbers. That is the standard (Firefox is just being nice to you).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...