★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum3/HTML/000305.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  JavaScript
  convince NS that the layers are an object

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   convince NS that the layers are an object
$Brian
Junior Member
posted April 22, 2000 12:09 PM     Click Here to See the Profile for $Brian   Click Here to Email $Brian     Edit/Delete Message Reply w/Quote
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.

firepages
Member
posted April 23, 2000 08:38 PM     Click Here to See the Profile for firepages   Click Here to Email firepages     Edit/Delete Message Reply w/Quote
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

Argrajoca
Member
posted April 25, 2000 05:11 PM     Click Here to See the Profile for Argrajoca   Click Here to Email Argrajoca     Edit/Delete Message Reply w/Quote
No very sure, but why don't try:

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

Hope it helps

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.