Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Netscape 6 and showing layers/divs

  • 30-08-2001 3:55pm
    #1
    Closed Accounts Posts: 9


    I have a popup menu that is made visible by an onMouseOver trigger.

    The code to do this in Netscape 6.0 looks something like this:
    document.getElementById("popup").style.visibility ="visible";
    

    This works fine, except that the first time the mouse goes over the link nothing happens. Every subsequent time though the DIV "popup" appears, as I want. Is this a quirk in NS6? Does anyone knows a workaround or different approach?


Comments

  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    It sounds like a flaw in the logic rather than a bug in NS. Any chance of seeing the code?


  • Closed Accounts Posts: 9 Pazz


    It ain't too pretty but here are the main functions.

    <script type="text/javascript" language="JavaScript">
     <!--
     //################################
     // The Popup Menu Script
     //################################
     var isNS6 = false;
     // For Netscape 6 support
     if((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 5)) isNS6 = true;
     
     if (!document.all && !document.layers && !isNS6)event=null //safeguard old browsers against error's trying to access event object
     var jnDisp=new Array(0,0,0,0,0,0);
     var jnDiTi=new Array();
     var theMenus=new Array(8);
     yes = "yes";
     no = "no";
     distanceFromLeft=220;
     
     // Use divs for IE and NS6+
     if(document.all || isNS6){
    	for(i=0; i < theMenus.length; i++){
    		theMenus[i] = "<div id='menu"+i+"' style='position: absolute; top: 0; left: "+distanceFromLeft+"px; visibility: hidden;' onmouseover='showMenu("+i+",event,no)' onmouseout='hideMenu("+i+")'>";
    	}
    	endMenu = "</div>"
     }else{
    // Use layers for Netscape 4.7 and lower
    	for(i=0 ; i < theMenus.length; i++){
    		theMenus[i] = "<layer name='menuLayer"+i+"' onmouseover='showMenu("+i+",event,no)' onmouseout='hideMenu("+i+")' visibility='hide' top='0' left='"+distanceFromLeft+"'>";
    	}	
    	endMenu = "</layer>"
    }
    
     function showMenu(num,e,move){
      if (document.all){
       jnDisp[num]=1;
       clearTimeout(jnDiTi[num]);
       for (i=0;i<theMenus.length;i++)if (i!=num)eval("menu"+i+".style.visibility='hidden'")
    	eval("menu"+ num +".style.visibility='visible'");
       if(move == "yes"){
       	eval("menu"+ num +".style.top=e.y-10+document.body.scrollTop");
    	}
      }else if(isNS6){
      	jnDisp[num]=1;
    	clearTimeout(jnDiTi[num]);
    	for (i=0;i<theMenus.length;i++){
    		if (i!=num){
    			eval("document.getElementById('menu'+i).style.visibility='hidden'");
    		}
    	}
    	eval("document.getElementById('menu'+num).style.visibility='visible'");
    	if(move == yes){
      		eval("document.getElementById('menu'+num).style.top=e.pa***+'px'");
    	}
      }else if (document.layers){
       jnDisp[num]=1
       if (eval("e.target!=document.layers.menuLayer"+num)){
        eval("document.layers.menuLayer"+num+".top=e.pa***")
        }
       for (i=0;i<theMenus.length;i++)if (i!=num)eval("document.layers.menuLayer"+i+".visibility='hide'")
       eval("document.layers.menuLayer"+num+".visibility='show'")
      }else{}
     }
     
     function hideMenu(num){
      if (document.all || document.layers || isNS6){
       jnDisp[num]=0
       jnDiTi[num]=setTimeout('killLayerMenu('+num+')',500)
      }
     }
     
     function killLayerMenu(num){
      if (document.all){
       if (jnDisp[num]==0)eval("menu"+ num +".style.visibility='hidden'")
      }else if(isNS6){
    	if (jnDisp[num]==0)eval("document.getElementById('menu"+num+"').style.visibility='hidden'")
      }else if (document.layers){
       if (jnDisp[num]==0)eval("document.layers.menuLayer"+num+".visibility='hidden'")
      }
     }
     //-->
    </script>
    

    The Divs look like:
     <script language="JavaScript">
    	document.write(theMenus[0]);
    	</script>
          
    <table border="0" cellpadding="0" cellspacing="0" width="146" height="86" background="images/menu.gif">
      <tr> 
        <td bordercolor="#D9DFEC" align="center" valign="middle" > 
          The popup menu.
        </td>
      </tr>
    </table>
          <script language="JavaScript">
    		document.write(endMenu);
    </script>
    
    And the trigger:
    <a href="#" onMouseOver="showMenu(2,event,yes);" onMouseOut="hideMenu(2);">Links</a>
    
    This one has really got me? I think I'll just forget NS6 users.


  • Registered Users, Registered Users 2 Posts: 1,747 ✭✭✭Figment


    Ive had a lot of problems in the past trying to make pages work in netscape 6 untill i discovered that if you take out the doc type, most of them dissapear. Now i quite like the browser.


  • Closed Accounts Posts: 2,695 ✭✭✭b20uvkft6m5xwg


    Can you post a link for the page itself so one could see it.

    I've had a few probs w/ NN6 alrite.
    I'd say the best advice is to get a menu you know for certain works in NN6 & then tinker w/ that. There are plenty that work very well-for instance the one from Macromedia Fireworks 4.

    Post a link so we can have a look smile.gif

    80p.
    SAVE CHIP !!


  • Closed Accounts Posts: 2,695 ✭✭✭b20uvkft6m5xwg


    double post frown.gif
    bloody browser mad.gif

    [This message has been edited by 80project.com (edited 05-09-2001).]


  • Advertisement
  • Closed Accounts Posts: 9 Pazz


    Got the Page up at last,

    My menus page

    :)


Advertisement