/    Sign up×
Community /Pin to ProfileBookmark

newbie assistance with multiple dropdowns

Hello,

Please suffer a fool for a moment…

I’m just learning javascript and I’m having a difficult time setting up a page with multiple drop down menus that will be used for navigation. I need four drop downs on the page, each with links to different pages. The dropdowns will be used to group like links together. The problem is that after struggle to create the code myself I have resorted to cutting and pasting code from this site. The first dropdown will work, but every other dropdown fails, with an error of “xxx is undefined object or null.”

Here is the code I’m attempting to use:

<!– Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End –>
</SCRIPT>
</HEAD>

and later in the body:
<center>
<form name=”form”>
<select name=”site” size=1>
<option value=””>About the Library
<option value=”http://www.yahoo.com”>Yahoo
<option value=”http://www.metacrawler.com”>Metacrawler
<option value=”http://www.altavista.digital.com”>Altavista
<option value=”http://www.webcrawler.com”>Webcrawler
<option value=”http://www.lycos.com”>Lycos
<option value=”http://javascript.internet.com”>JavaScript Source
</select>
<input type=button value=”Select” onClick=”javascript:formHandler(this)”>
</form>
</center>

Note: The links provided above are the basic links that the original code I copied contained. The finished product is for a library, and will link to pages at the library site, sorted by genre.

Any idea what I am doing wrong here?

Any help would be appreciated, and earn you 100 karma points ?

Jeff

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Tasmanian_DevilAug 22.2003 — [URL=http://forums.webdeveloper.com/attachment.php?s=&postid=82998]check this out.[/URL] It might give you an idea to work off of. Another user has been helping me with the same idea, however I only need three not four drop down menus
×

Success!

Help @acura1jsc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...