#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    3
    Rep Power
    0
    I'm having a few problems with NS seeing that some of the layers that I have are actually objects.
    I have show() and hide() that work, I just don't want to have onmouseover=15 hides
    so, I tried to create an array that lists all of the layers. Then, a function hides all of those layers and shows only the ones that need be - here is the function:

    function showSubNav(left,right) {
    layername = new Array(layernames are here);
    for(i= 0 ; i < 16 ; i++) {
    hide(layername[i]);
    }
    show(left);
    show(right);
    }
    my html code looks like this:
    <a href="" onmouseover="showSubNav(layerleft,layerright);">

    The layers exist and if my html code looked like this, it would work:

    <a href="" onmouseover="show(layerleft); show(layerright); hide(hiddenlayer); hide(morehiddenlayers until done);">


    But all that code is extrenious - the show()'s and hide()'s do work though.

    So, basically, when I call the showSubNav() function, netscape then kicks back that the first element in the array list is not an object.
    But, if I had done it out long hand, it would have worked, so therefore the object does exist.

    Ok, I hope that I just made sense.

    Thanx.
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    you just have to tell your hide script which div to hide - in the code below you need to set active as the div that is visible when the page opens - if you have no visible divs on the page opening make one that is empty and invisible because you need to set active to something.

    Then your mouseover would be ="SL('nameofdiv')".... etc, then the div is made visible and active is set as the open layer which will get closed on the next SL('nameofdiv') call.

    var active='div1';
    function SL(id) {
    if (document.all) { document.all[active].style.visibility = "hidden" } else {
    document.layers[active].visibility = "hide"}
    active=id;
    if (document.all) { document.all[active].style.visibility = "visible" } else {
    document.layers[active].visibility = "show"}
    }

    you can modify this code to open and close multiple divs quite easily, you just need to set a few more variables.

    (and yes my browser sniffing looks a bit dodgy but only V4+ browsers ever get sent to this page)

    Simon.

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    SPAIN
    Posts
    47
    Rep Power
    15
    No very sure, but why don't try:

    eval('hide('+layername[i]+')');

    Hope it helps

Similar Threads

  1. my comp sux lately , need help from pro's
    By Hykinsel007 in forum Windows Help
    Replies: 2
    Last Post: January 5th, 2004, 02:52 PM
  2. Accessing my object in JSP
    By Gajan_Raj in forum Java Help
    Replies: 3
    Last Post: September 21st, 2003, 07:28 AM
  3. Returning a reference to an object
    By pdonut in forum C Programming
    Replies: 3
    Last Post: July 4th, 2003, 06:59 AM
  4. Storing an object in a session variable
    By JMM in forum PHP Development
    Replies: 6
    Last Post: April 10th, 2003, 11:32 PM
  5. fetchstructure: POP3=OK IMAP=NO
    By Calgyria in forum PHP Development
    Replies: 8
    Last Post: May 13th, 2002, 12:43 PM

IMN logo majestic logo threadwatch logo seochat tools logo