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

Javascript Menu Not working, itworked in the beginning!

Status
Not open for further replies.

murlkg

Technical User
Jun 5, 2008
4
0
0
US
Hi there.
I found this script on When following the instructions exactly The script worked as the author promised.
The author is not available to contact so I need someone's help. please.

When I started putting in my own information something went wrong. I have checked and checked and can not see where I made a mistake.

Would someone be so kind as to tell me where my mistake is so I can use this script again. Thanks so much.


Here is what I am using currently. As I said it worked before. What did I do?????

--------------------------------------
var c4uNav = ' <A HREF="info.html"><STRONG>Info </STRONG></A><BR><Br> '
+ '<A href="share.html"><STRONG>Share</STRONG></A> <Br><Br> '
+ '<A href="off.html"><STRONG>Off </STRONG></A> <Br><Br> '
+ '<A href="go.html"><STRONG>Go </STRONG></A><BR><Br> '
+ '<A href="props.html"><STRONG>Props</STRONG></A> <Br><Br> '
+ '<A href="his.html"><STRONG>His</STRONG></A> <Br><Br> '
+ '<A href="mag.html"><STRONG> Mag</STRONG></A> <Br><Br> '
+ '<A href="books.html"><STRONG>Books</STRONG></A> <Br><Br> '
+ '<A href="video.html"><STRONG>Video</STRONG></A> <Br><Br> '
+ '<A href="study.html"><STRONG>Study</STRONG></A> <Br><Br> '
+ '<A href="universe.html"><STRONG>Universe</STRONG></A><BR><Br> '
+ '<A href="search.html"><STRONG>Search</STRONG></A> <Br><Br> '
+ '<A href="free.html"><STRONG>Free </STRONG></A> <Br><Br> '
+ '<A href="health.html"><STRONG>Health</STRONG></A><Br><Br> '
+ '<A href="other.html"><STRONG>Other </STRONG></A><Br><Br> '
+ '<A href="final.html"><STRONG>Final </STRONG></A> <Br><Br> '
+ '<A href="buy.html"><STRONG>Buy</STRONG></A> <Br><Br> '
+ '<A href="link.html"><STRONG>Link</STRONG></A> <Br><Br> '
+ '<A href="contact.html"><STRONG>Contact </STRONG></A> '
 
Looks ok to me (apart from the random capitalisation of tag names - these shold be lower case).

I suggest you remove all your changes - return to the point you were at before you started adding stuff (until it works)... and then add stuff one change at a time (until it breaks again). Then you will know what is causing the problem... and you will be able to start attempting to solve it.

There is no shortcut to this.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Thanks so much!!!
That is the confirmation I was looking for.
I feel better. lol
Thanks again for your all your help it is really appreciated.
 
Why would you want to use javascript to create that menu, anyway?

There's no layers that drop in or any other special effects - it's just a list of links. Using HTML and a bit of CSS would replicate that menu exactly.

What happens if someone visits your site with javascript turned off? They get no menu. Google also won't spider javascript links - which means you'll get a better google ranking w/o using javascript to do this.


Javascript is best used as a precautionary form of form validation (that is also replicated server side), powering ajax, and adding in things that spice up your page. It should not be relied upon for anything in your page that is important (such as the navigation menu)

-kaht

<. is live!
Please visit us at
 
Hi Kaht.
I had no idea of all that you mentioned.
I am so glad you responded. I dont really know how to do CSS. I didnt want to send the link of my website to the forum as people might think I am spamming. How do I send a PM or my link without having trouble with the forum. Or if you could refer me to a very, very simple css tutorial to add a menu where I can add a link to the menu with out having to add a link to multiple pages. I would appreciate a little more help. Thanks so much for all the insight.
 
I have found some really simple CSS sample menus.
I will go with that for now. Thanks for all the help.
 
Sorry for the late response. I have been spending less and less time here @ TT since the release of our new IT forum (link in my signature), and I missed your reply.

Since you've gotten some sample CSS menus off google, let me make another suggestion for good reading material. One reason that many people justify using javascript to power their navigation menus is that they can import the javascript file on each page to draw the navigation menu. When you make a change to your navigation menu, you just make the change to the 1 .js file instead of every page on your site.

However, most web servers support this feature server-side which alleviates the need to use javascript.

Have a read here:


-kaht

<. is live!
Please visit us at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top