Results 1 to 3 of 3

Thread: [RESOLVED] hiding elements with onclick & id.style.display='none' - not working in FF

  1. #1
    Join Date
    Jun 2009

    resolved [RESOLVED] hiding elements with onclick & id.style.display='none' - not working in FF

    what i'm trying to do is hiding certain divs based on what language the user clicks on. the method i use atm only works for IE, Opera and Safari; but with Firefox i get a ' is undefined' error...

    all help is welcome, below are some code snippets:

    this is html part on top of my page, where users choose the language they want. below this part will be the divs with id's contentNL and contentENG
    <h5 id="lang">
    <a href="#" onclick="contentENG.style.display='none';contentNL.style.display='block'; " name="eng">NL</a> :: 
    <a href="#" onclick="contentNL.style.display='none';contentENG.style.display='block';" name="nl">ENG</a>
    these are the short versions of the divs below the previous code:
    <div id="contentNL" name="contentNL">
    <div id="contentENG" name="contentENG">

    I really have no clue why Firefox gives these errors:
    "contentENG is undefined" / "contentNL is undefined"

    all help is very much appreciated

  2. #2
    Join Date
    Feb 2006
    firefox does not make element ids global identifiers.


    This will work as well in the other browsers.
    Last edited by mrhoo; 06-19-2009 at 10:14 AM.

  3. #3
    Join Date
    Jun 2009
    You're right, this works perfectly!

    Thank you very much

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles