external navigation menu
I need to know how to link an external navigation menu...I would like to be able to update one file and have it changed on all my pages. I've tried doing the javascript, but that didn't work for me, I'm sure it works but I just cann't seem to get it to.
I put this code on a sample page:
<script language="Javascript" SRC="http://www.enchantedeveningsboutique.com/men.js"></script>
and made the js file (shorted here:
")
document.close()
//end hiding contents-->
but when I link to the file I had it on "template2.htm" nothing comes up.
Is there a simple or better way to do this?
thanks,
Mamie
Busy posted this at 20:29 — 12th November 2002.
He has: 6,151 posts
Joined: May 2001
I think the problem is to many quotes, you have:
document.write("')
I take it you realise there is no link word or end tag in there
also instead of language="Javascript" you should really use type="text/javascipt"
Busy posted this at 20:34 — 12th November 2002.
He has: 6,151 posts
Joined: May 2001
that post of mine confused me lol, so will try explain it better
What I did was remove the double quotes from the beginning and end and replace with single quotes, and any single quotes used within the line is escaped with the slash.
So any other lines you have to the same and just make sure you have no single quotes in the line anywhere that aren't escaped, even text needs it
(' this does need quoting or it wouldn't work ')
the above wont work as there is a single quote in "wouldn't", so should be:
(' this does need quoting or it wouldn\'t work ')
the "\" isn't displayed on the page
mamie47 posted this at 21:21 — 12th November 2002.
They have: 21 posts
Joined: Oct 2002
Actually, I don't even know what a link word or end tag is! (lol) All I do is copy and paste javascript...
I tried to do all the things you said and I still couldn't get it to work. I guess I will give up on external navigation.
thanks,
Mamie
Suzanne posted this at 23:50 — 12th November 2002.
She has: 5,507 posts
Joined: Feb 2000
Do you have any server-side languages on your server? You may have better luck using includes with php or SSI.
Link word = the text that people click on
End Tag = the closing tag for the hyperlink,
Suzanne posted this at 23:54 — 12th November 2002.
She has: 5,507 posts
Joined: Feb 2000
Also, that's why nothing's coming up. Try this:
Your link text goes here')
document.close()
//end hiding contents-->
If it works, then you have it right, and can repaste in the onmouseover segment (which uses images -- if you're only using text, don't bother).
mamie47 posted this at 01:45 — 13th November 2002.
They have: 21 posts
Joined: Oct 2002
boy, do I feel stupid!...I thought he was talking about something with javascript! I guess when I copied just a portion of the script I left off the closing tag.
I checked into the SSI, and it seems to be easier, however, my server is not set up for it and I don't know anything about it to go in and do a server configuration. I checked into the conf directory and there were no files for srm.conf or access.conf...it was empty.
I think my problem is there's too much to learn and too little time to do it.
thanks for the help,
Mamie
mamie47 posted this at 00:20 — 14th November 2002.
They have: 21 posts
Joined: Oct 2002
well I have progressed a little. So far I have a footer.js, header.js and one for logo.js. I still can't get the navigation to work with the buttons. It will do a button but not a mouseover.
Suzanne, I pasted what you wrote and it did work...I could add the image, but when I put the mouseoverscript it died.
I'm gonna keep working at it...
thanks
Suzanne posted this at 02:09 — 14th November 2002.
She has: 5,507 posts
Joined: Feb 2000
If you have an url for a working demo, post it and we can walk through and troubleshoot it easily for you. It's usually a semi-colon, in my experience, or an unescaped quotation mark.
mamie47 posted this at 12:55 — 14th November 2002.
They have: 21 posts
Joined: Oct 2002
It didn't work so I deleted it to start over and I'm not going to be able to work on it again until probably the weekend, I've got to work today and tomorrow. But as soon as I get another one I will post it...this sure is going to make site maintenance a lot easier.
thanks again,
Mamie
mamie47 posted this at 02:49 — 16th November 2002.
They have: 21 posts
Joined: Oct 2002
looks like I'm at it again. I've got a templated loaded with 3 external link files, the logo.js and the footer.js are fine. on the navigation.js the first 2 functions worked fine, one with text and one with image, but when I tried to do the mouseover they died. Don't know what I did, but it won't work at all on mouseovers.
http://www.enchantedeveningsboutique.com/template.htm
thanks,
Mamie
Busy posted this at 04:07 — 16th November 2002.
He has: 6,151 posts
Joined: May 2001
I had a quick look, your missing a tag
and the code inside your naviagtion.js has a couple of errors
thisis the line with the errors
document.write(' ')
here is the fix:
document.write(' ')
the onMouseOver bit was causing the problem, you had escaped the double quotes when you need to escape the single quotes.
Also in that code is a few document.close()'s you only need one, but unless it's actually being used, which I don't think it is, isn't needed at all, also the comments aren't needed.
mamie47 posted this at 15:29 — 16th November 2002.
They have: 21 posts
Joined: Oct 2002
I had my header.js but deleted it because I've got to fix the path, I guess I deleted too much!
looks like I'm finally getting somewhere...I copied and pasted and had a terrible time until I realized that I had the script on my template too....I'm sure that caused some errors too. The image is showing up and the link is working but the mouseover doesn't work, I guess that's what the error is. I've only used the portion of the script that relates to this one button but that should cause a problem as long as the image name is correct should it? The error I'm getting now is document is null or not an object(???)
thanks again,
Mamie
Busy posted this at 21:16 — 16th November 2002.
He has: 6,151 posts
Joined: May 2001
The error this time is document[iName].src = pSrc; saying the document[...] is not an object.
What you need to do is add all the code and buttons you're going to use then work backwards finding the fault, Some sections of this don't really need to be included in .js files as it looks like you'll have lots of pages and seperate sections so not much of the code would be reuseable.
mamie47 posted this at 00:04 — 17th November 2002.
They have: 21 posts
Joined: Oct 2002
looks like I'm gonna have to start searching again!
At this time I have four separate sections-men/women/plus/home...each has it's own separate mouseover script. So if I EVER get this to work, it will make updating all the pages a lot easier.
thanks again,
Mamie
Suzanne posted this at 01:14 — 17th November 2002.
She has: 5,507 posts
Joined: Feb 2000
You shouldn't need to use a separate mouseover script for each, just unique image names in the array.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.