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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide HTML (not via checkbox or radio button) 1

Status
Not open for further replies.

GuidoZ

Technical User
Nov 2, 2003
17
US
I've always been amazed at the amount of helpful people here, so I decided to ask a question of my own! I searched for a solid 15 minutes (all the way back to 2003) and didn't find anything that answered this question. Some got close, but when I tried them myself, I couldn't get it to work in the fasion I'm after. (I also checked the FAQs.)

What I want to do seems like it should be rather simple, I just don't know enough code to do it. (I'm not a n00b when it comes to Javascript/CSS/HTML; however I'm certainly not a programmer!) I have a javascript menu that works perfectly. (Tigra Menu Gold v2.6) If you're not familiar with it, check it out here:

I have it setup so that it works within a TD cell. (That way it centers with the page and such.) When I was using the free version, it simply overlayed the javascript menu wherever you asked it to. By doing this, I could have a regular HTML menu behind it in case someone didn't have javascript enabled. It worked well. With the new version, it becomes an object on the page and inserts itself into the HTML page. So now if I have a HTML menu, it goes above it, below it, beside it, etc - not OVERTOP of it.

What I'm trying to do is find a javascript that will hide that HTML menu. Reason: I figured if the user had javascript enabled, this magical javascript would hide the plain old HTML menu and the Tigra Menu would display as usual. However, if they had javascript disabled, nothing would happen - the script to hide the HTML menu wouldn't run and the Tigra Menu wouldn't run. Make sense? (I hope.)

The regular menu is nothing fancy. CSS takes care of all formatting... the HTML is just your basic stuff like:
Code:
<a href="home.html">Home</a> | <a href="contact.html">Contact us</a> | <a href="stuff.html">More stuff</a>

I'm looking for a javascript (container?) that would *NOT* allow the code to be written if executed, or simply let the code be if javascript isn't enabled/run. If anyone would like more info or examples of the current state, let me know and I'll whip something up to post. Thanks in advance for your excellent help! I appreciate the time and effort.

--
Peace. ~G
 
Have you tried putting the code inside <noscript> tags for browsers that have Javascript disabled?

Lee
 
No I hadn't, but I will... Thanks. (It was my understanding that this disabled all scripts even with javascript enabled.)

(time passes...)

I tried it and it disabled it alright, but the menu script won't run even if javascript is enabled. If they have Javascript, obviously I'd like to utilize it. Is there a way to use the noscript tag only if someone *doesn't* have javascript enabled?

I'll get an example ready so my point can be more clear. Hopefully it will help to have a visual demo. :) Thanks for the replies.

--
Peace. ~G
 
Ok, I made a few quick 'n dirty example pages. (Much of the CSS formatting and such has been removed. Ignore the ugliness.) I have made the pages so you don't have to alter your javascript settings at all. (In the demos where Javascript is "disabled", I removed the javascript to show what it would look like.)

Here is roughly the way it looks and operates now:
-
If the user has javascript disabled, they see this instead:
-
I'd rather they see this if they had javascript disabled:
-
If I try and add the HTML menu myself, users with Javascript see this:
-
I hope that helps explain the situation! =) I'm looking for some javascript that will hide the simple HTML menu when executed, however do nothing to it if not executed.

Thanks again for any assistance.

--
Peace. ~G
 
Ok, I think I see what trollacious was trying to say before - put the HTML menu snippet in noscript tags. Duh...

It worked. At first I thought it wasn't working in Firefox/Mozilla and only IE, then I realized I hadn't saved it. =) *sigh*

Thanks for the help. Just a brain fart I guess. Rated.

--
Peace. ~G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top