Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show hide layers 1

Status
Not open for further replies.

TGWW

Technical User
Feb 20, 2001
26
GB
I am working on a Javascript/DHTML nav bar. I need to make a floating box dissapear when mouseover a certain image and im having real dificulties doing so. Can someone enlighten me!!!!#

Thanks

Phantom
 
ie 4+ and ns 6+ --> ref_to_your_elt.style.visibility="hidden" or "show"
ns 6- --> ref_to_your_elt.style.visibility="hide" or "visible" (you should check in the docs for the latest as i'm not 100% sure)
 
Im sorry.. i should have explained that I am new to Javascript.. I have been learning ofr only 5 days. I understand the basics but please can you be clearer. And thank you for your help :)
 
--> firing the event ("when mouseover a certain image ")
<img src=... onmouseover=&quot;hide_floatingbox()&quot;>

--> your floating box (... i suppose it's a <div>...</div> element but it's the same whatever the tag you're using (almost))
<div id=myId>your floating box or anything</div>

--> the jscript function now ! (&quot;to make a floating box dissapear&quot;)

function hide_floatingbox(){
document.all.myId.style.visibility=&quot;hidden&quot;
}


--> this code will work provided you only have ONE element which id is &quot;myId&quot;, and ONLY in explorer 4+ (NOT in netscape, appart maybe netscape 6+)

--> becareful that you'll hide the box but you're not showing it again afterwards ;-)

--> let me know ! have fun anyway ;-)
 
Thank you very much :)

It worked. You are a genius!

:)
 
Is the reason it wont werk in netsacpe to do with the way the browser addresses layers and is there a work around?
 
document.all.myId.style.visibility=&quot;hide&quot; is a first fix for netscape
and then if it isn't enough, yes, you have to adress your element differently ... i'm really sorry, it's a long time i haven't coded any jscript for netscape, so i can't remember exactly - it's a really easy fix - and i don't have enough time for testing either ... so i'm afraid you have to wait for someone else to answer here !!! or use the super &quot;keyword search&quot; tab ;] (i KNOW this question has been answered many many times !)
 
document.layers.layername.visibility='hide'
This works in netscape but not IE

document.getElementById('layername').style.visibility=&quot;hidden&quot;

I discovered works in the latest versions of IE and Netscrape. If theve got an old version they can DOWNLOAD THE LATEST VERSION! :)
 
TGWW:

I'm glad you reached this conclusion :) Isn't it nice to be able to write fully funcitonal cross-browser dhtml, without a single &quot;if(iscrappybrowser)&quot; line?

We need to force (assist?) users in upgrading to new browsers. let them know what they are missing! jared@aauser.com -
 
no i think &quot;force&quot; was the right word!!!! Darn it the things FREE sort it out :)
 
as a programmer i have to agree with you
as a user i don't ... at home i'm using a crappy old ns4 or even older ... because most of the time i *hate* those mouseover, dynamic menus, changing fonts (even when i'm using ie5+ here ;))) .... 1st they are almost the same wherever you go, 2nd they often add NOTHING to the site - just slow it down a bit (i must admit that when it's original AND useful i don't complain, but it's not often the case !!). When i get a &quot;you should update click here to download the newest version&quot; i never ever. I know i might shock everyone here, but i think from times to times we should get the user's point of vue ... in which way can a dynamic menu be helful for a user for example ? (even if as a programmer, i wrote looooads of those ;]] - but i was asked to !)
i'm sorry this is totally of topic ...
 
The nature of the internet is that it is a dynamic constantly evolving entity. You cannot use the internet and not expect it to change even over a very short time. The internet is the fastest growing area of media and therefore the fasest evolving. Therefore as its users we must be prepared for the occasional download to help push the internets evolotion.

As for the navigation system not being helpful.. MINE IS :_) but i agree that in many instances they arnt that they are just flowery dressing.. but then the internet is a visual media and as bandwith increases over time unecessary &quot;fancy&quot; things are going to become more common place along with sloppy coding.

Any way ill shut up now :)
 

Real developer should be able so create things that work regardless any conditions. Don't look for excuses like &quot;old browsers&quot; and &quot; holding back the web&quot; - it's nonsence!

iza - I'm on your side!
 
thank you andrew :)))
actually, everyone is right ... yes there's a point where people have to give up oooold habits (we don't use cassettes or 3.5 (inches?) disks anymore ... there are less and less cobol coders ....) - but no, i don't think i have to run to new technologies just because they are new [and because and &quot;bandwith is increasing&quot; (mine isn't !! my modem is still 14.4 k ;]]]] !! i'm waiting for it to burn out before buying a new one ...) - i mean, yes it increases, but if it is to get more and more crappy personnal sites with heaaavy mouseovers .... what's the point ? they'd better let the bandwith free !!!]
 
And real developers we are. I choose not to develop sites for netscape 4, as I feel that it is a ridiculously awful browser. Andrew, do you have a website? Does it support lynx? webtv? konqueror? Amiga-AWeb? Amiga Voyager 3? Netbox?How about IE1.0,or Netscape 2? If developers continue(d) to make support of these browsers commonplace, new innovations would never have become commonplace. If you must support NS4 (as per client request) kindly explain to them that it will cost double the money (as it is double the work) and explain tot hem the features that will not be available. I for 1 can list about 11,299 things that Netscape 2.0 simply can't do. It's a good thing sites stopped supporting that browser, else we'd still be doing it.

jared@aauser.com -
 
ok im not saying that this is good or right just that this is the status of the internet and the way its developing and a few people sticking to older browsers or slower connections isnt gonna slow it down. So if you cant beat em, join em and influence it positively.

Just to prove that im not all bad - simply by using Javascript instead of Golive CSActions ive managed to reduce my nav bar from 6000 lines of code to 160 lines. The easy would have been to use golive and it would have taken me a fraction of the time and caused me a lots less headaches.. but it was to heavy so I re did the nav bar using Java script which I had to learn in the process!
 
C'mon, jaredn! Noone doubts here in your professional skills. And of course I didn't mean you personally.

Please, don't exaggerate. Noone is talking about IE1.0 or Netscape 2. Today's situation is that Netscape6 didn't justified our hopes (it's not only my personal opinion), and lots of users will not upgrade to it, at least soon. As a user, I understand them. That means that NN4.x will still remain in a valuable force, also weaker than it used to be. I don't hate NN4.x like you, though I'm familiar with all it's issues - I'm neutral to all of them.
As developers, we have to face the present situation - IE, NN4.x and N6 are on one line.
That was my point.

P.S. Well, I'm not absolutely neutral and I have one favourite - Opera browser. It's an amazing thing and the list of it's advantages is far longer than the list of it's disadvantages. And I'll be happy if someday it will conquer the market - it deserves it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top