|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
No very sure, but why don't try:
eval('hide('+layername[i]+')'); Hope it helps |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > convince NS that the layers are an object |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|