SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Show/hide menu problem in Opera

    Hi!

    I'm building a simple onmouseover show/hide menu. This code below is working in IE and Mozilla but I can't get it work in Opera. In IE and Mozilla when 'show' I can see links and click on them, but in Opera I can only see links but can't click it... Any ideas?
    Thanks.

    <html>
    <head>
    <script language="JavaScript" type="text/javascript">
    function showMenu(swhere) {
    var x = document.getElementById(swhere);
    see_this = new Array("one<br>", "two<br>", "three<br>", "four");
    see_thisLen = see_this.length;
    for (var i = 0; i < see_thisLen; i++) {
    x.childNodes[i].innerHTML = see_this[i];
    }
    }
    function hideMenu(hwhere) {
    var y = document.getElementById(hwhere);
    for (var i = 0; i < see_thisLen; i++) {
    y.childNodes[i].innerHTML = '';
    }
    }
    </script>
    </head>
    <body>
    <div style="border: 4px solid; width: 70px" onmouseover="showMenu('num_sub');" onmouseout="hideMenu('num_sub');">Numbers<div id="num_sub"><a href="1.htm"></a><a href="2.htm"></a><a href="3.htm"></a><a href="4.htm"></a></div></div>
    </body>
    </html>

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't use JavaScript for this. This can be done very easily uisng HTML and CSS (though IE 5, 5.5 and 6 will need some JavaScript since they don't understand :hover on anything but links).

    The first thing you need to do is use a proper DOCTYPE. I normally use XHTML 1.0 Strict, but looking at your code, I'd go with HTML 4.01 Strict instead.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm! Maybe I'll try with css. I have DOCTYPE but didn't post it with code.
    Thanks

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something I forgot to mention. Get rid of language="JavaScript" (you don't need it).


Bookmarks

Posting Permissions

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