473,326 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Possible to hide/show div layers on Browser Use / Versions?

Is it possible to control div visibility upon Browser sniffing?

EXAMPLE:
If someone with Explorer views my site one version of a <div 1> nav bar layer shows, the variant nav <div 2> layer is hidden.

And, if other browers are used then the other version of the <div 2> nav bar is loaded while the Explorer <div 1> nav bar is hiddden.

Seems like this should be possible. But I can't find any examples.

Thanks in advance.

Geoff
Jan 26 '07 #1
4 2163
acoder
16,027 Expert Mod 8TB
Browser sniffing is bad practice. You should really check for the existence of objects and support for them rather than depending upon browser sniffing, but if you must, here is one example of browser sniffing code:
http://www.howtocreate.co.uk/tutoria...s/sniffer.html

Is it not possible to code the div that it works in all browsers rather than having something special for IE? Perhaps you could post the code and see how it could be altered to work in all browsers.
Jan 27 '07 #2
Hi, thanks for the reply.

What I really want to accomplish from this project is getting a top level nav menu which uses css and dhtml. But using css & dhtml won't work well (at all) on older Explorer browsers.

So, my thought is to put two different nav menus, one css & the other simple html, into two different div tags. When the site pages are loaded, the browser that is used will determine which div tag is shown, while the other hidden, and thus the proper nav menu will be available for use.

Still looking for any help on this.

Regards,

Geoff
Jan 28 '07 #3
pronerd
392 Expert 256MB
if( document.all ) {

}

Is lazy general test for IE. As mentioned it would better to test for the commands being used though. Visablity can be controled by <<Element>>.style.display='none' to hide, and <<Element>>.style.display='block' to show.
Jan 28 '07 #4
Thanks, I'll give it a whirl.
Jan 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of...
10
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
2
by: geotso | last post by:
Hi I'm looking for a javascript with the following operation: if history.length <=2 show "layer1" and hide "layer2" else hide "layer1' and show "layer2"
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
4
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.