PDA

View Full Version : Resolved Help the script is not working-all files linked



ajfmrf
01-31-2011, 03:26 AM
Hi Folks, I am back trying to figure out why this wont' work:

The original script is on this page that works fine:
http://web-user.net/rss/test/drop.html

Now I want to put the javascript in to a file by it self:
http://web-user.net/rss/test/drop.js

And tried the link to the external file on this page:
http://web-user.net/rss/test/drop2.html

Now I can tell that it is not working due to the text in the dropdown when the page loads-it should have JavascriptKit in it.This is a place holder is there instead telling me the javascript code is not being rendered (is that the right way to say it?)

What is wrong with the drop.js file? I thought the start and end tags(<script></script>) have to be removed.

I am confused with this and any help would be greatly appreicated.

Thanks,

Bud


ps-Would people prefer to have the code put here instead of the links to each file?I want to do this the prefered way if I can :)

azoomer
01-31-2011, 07:32 AM
It seems to work if you put the javascript at the bottom of the page instead of in the head section. I guess the form has to load before the script for it to work.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>dropdown test</title>
</head>
<body>
<form name="dynamiccombo">
<select name="stage2" size="1">
<option value="#">This is a Place Holder</option>
<option value="#">This is a Place Holder</option>
<option selected="selected" value="#">This is a Place Holder</option>
</select>
<input name="test" value="Go!" onClick="gothere()" type="button">
</form>
<!--SET up your links, and pass in the name of the group (ie: combo1) you wish to display for the link in question-->
<a href="javascript:populate(combo1)">Webmaster sites</a> | <a href="javascript:populate(combo2)">News sites</a> | <a href="javascript:populate(combo3)">Entertainment</a>
<p align="center">This free script provided by<br>
<a href="http://javascriptkit.com/">JavaScript
Kit</a></p>
<script type="text/javascript" src="drop.js"></script>
</body>
</html>

ajfmrf
01-31-2011, 09:38 PM
I guess that is something I should have tried but I never saw a script that works like that so I never thought it could work.

Thanks for your help azoomer

Bud

ps-how do the posts get mark as resolved?

djr33
01-31-2011, 10:53 PM
To mark a thread as resolved, edit your first post and use the dropdown menu to select "resolved".