SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    my dropdown sub menu

    Using innerHTML as key for this and I suspect that it's there it's gone wrong somehow.

    on the link I have the:
    HTML Code:
    onMouseOver="subMenu('sub_menu')"
    the javascript:

    PHP Code:
    function subMenu(menuName) {
      var 
    changeTo document.getElementById(menuName).innerHTML
      changeTo 
    "<b style='z-index:1; position:absolute; left:168 px; top: 250 px; background-color:#000000;'><a href='index.html'>link</a><a href='index.html'>link2</a></b>";} 

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you want to achieve with your script?

    You first grab the some elements innerHTML and store it in a variable called changeTo. After that you overwrite that variable with new HTML...

    I guess that you want to set the innerHTML property.

  3. #3
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the innerhtml has a "display:none" on the html page.
    When he" onmouseover" the main link this function gets called that removes (should remove) the "display:none" so the sub menu pop ups.

    How should I use the set command?
    I tried it infront of "changeTo" and after ".innerHTML.".

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function subMenu(menuName) {
      var element = document.getElementById(menuName);
      element.innerHTML = "<b style='z-index:1; position:absolute; left:168 px; top: 250 px; background-color:#000000;'><a href='index.html'>link</a><a href='index.html'>link2</a></b>";
    }
    Setting a property is something that you really need to know when scripting JavaScript. I suggest you take a JavaScript tutorial.


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
  •