I'd make sure the <script> tag is inside the head tags, and add type="text/javascript" to the script tag, and see if it works.
I decided to give up trying to hunt down the perfect javascript menu and make one myself.
Thing is, there's this part about loading a .js file directly onto the page instead of writing it straight on the page that I don't get. Supposedly, you're supposed to write "<script src="linky.js"></script>" is wherever you want the script to be, then create a separate file "linky.js", and whatever is in that .js file should appear wherever you intended it to be.
Tested it on the page directly, works fine.
Tried the loading separately technique, got zilch.
So like, anyone can tell me what I'm doing wrong?
I'd make sure the <script> tag is inside the head tags, and add type="text/javascript" to the script tag, and see if it works.
Winner of the Unown Awards: 2008 "Hard Work", 2010 "Dedicated", 2012 "Journalist", 2012 "Unown", 2013 "Anchorman", 2014 "Unown", 2015 "Jeff Jeff Jeff Jeff!"
Facebook - YouTube - Miiverse
Diamond: 1418 3196 1413 - SoulSilver: 0217 4582 5426 - White: 1119 9535 7054 - White 2: 1421 4560 4887 - X: same as 3DS
3DS: 3866 8018 5231 - AIM: IslanderJeff02
Joined November 8, 2004 - Modded October 24, 2008
Well, you have the correct code there, so I'd guess that there's just some silly little mistake somewhere that is screwing things up.
First, make sure that you didn't put those script tags into the "head" area of the document by accident (unless the JavaScript is supposed to be placed there and not in the body of the document).
Second, make sure that you spelled everything right, remembered to close your quotation marks on the link name, and stuff like that (I always screw that up, myself).
Make sure that there are no <script> tags within the external file itself.
If you're using relative linking like that (i.e. "filename.js" instead of "http://.....js"), make sure that you have everything in the same directory. Also make absolutely sure that you saved the script as a .js and not something else.
Yeah. It should work the way you've done it, so if none of those things seems to be the problem, perhaps post the source and I can look and see if I can figure out what's wrong with it; with what you've said, though, I couldn't think of anything else that might be a problem.
Avatar made by Jade Dragonair. Thanks very much, JD!
It's in the body, not the head.
<script src="linky.js"></script>
Here's what's inside the js file.
document.write("testing")
Simple basic write line. Still zilch. FYI for those wanting to know, I'm trying to do away with including a standard HTML menu on the side in every page, so I don't have to edit every page should I wnt to change the menu, so I figured javascript would be the safest bet (I'm not using frames, or iframes for that matter).
That's weird, it should be working, I tried it myself several different ways, in the head, in the body, with and without the type attribute defined. It worked every time (yeah even when placed in the head even though document.write code is supposed to go in the body).
What browser(s) are you testing this under?
Winner of the Unown Awards: 2008 "Hard Work", 2010 "Dedicated", 2012 "Journalist", 2012 "Unown", 2013 "Anchorman", 2014 "Unown", 2015 "Jeff Jeff Jeff Jeff!"
Facebook - YouTube - Miiverse
Diamond: 1418 3196 1413 - SoulSilver: 0217 4582 5426 - White: 1119 9535 7054 - White 2: 1421 4560 4887 - X: same as 3DS
3DS: 3866 8018 5231 - AIM: IslanderJeff02
Joined November 8, 2004 - Modded October 24, 2008
Tried rewriting a test page, is working now. Still, I can't get a link out.
<a href="javascripttart('index.html')";>index</a>
<a href="index.html">index</a>
That's what I changed, testing both a js link and a standard html link. Nothing came out.
Make sure your server is reporting the MIME type of the external Javascript file as "text/javascript" otherwise some browsers (Firefox springs to mind) will refuse to execute the code.
n/t
If that's what you're doing with it, IMO you should use SSI instead. Very simple to use, obviously doesn't have problems with people who disable JavaScript or whatever, and it's designed especially to do stuff like include navigation bars where you only want to modify one file to have the changes appear on every page in a web site. Also doesn't suffer the same problems as frames/iframes. JavaScript isn't really designed to insert content like that.FYI for those wanting to know, I'm trying to do away with including a standard HTML menu on the side in every page, so I don't have to edit every page should I wnt to change the menu, so I figured javascript would be the safest bet (I'm not using frames, or iframes for that matter).
Last edited by Negrek; 15th June 2007 at 11:09 AM. Reason: WTF was I calling it shtml for?
Avatar made by Jade Dragonair. Thanks very much, JD!
Geocities doesn't. Hence javascript.
If you're wondering, SSI was what I have been using for all my non geocities-based webpages.
Not very sure what you're talking about here. And uh, firefoz ain't gonna support this? Huh?Make sure your server is reporting the MIME type of the external Javascript file as "text/javascript" otherwise some browsers (Firefox springs to mind) will refuse to execute the code.
Btw, regarding my last post, that looks right, doesn't it?
IMO you should seek better free hosting than Geocities, but eh.
Firefox will support external JavaScript, but you have to make sure that the file is being correctly reported as a text/JavaScript file. If it's not, then you could try adding
<link href="whatever.js" type="text/javascript">
to the <head> of the page; I have no idea if that would clear the problem up or not, but I suppose it's worth a shot.
Avatar made by Jade Dragonair. Thanks very much, JD!