/    Sign up×
Community /Pin to ProfileBookmark

Need help with Javascript dropdown box

Hi i used a java generator on the web to give me the code

<form name=”jump”>
<select name=”menu”>
<option value=”http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=230&old_menu_id=230&ssm=1″>Administration</option>

<option value=”http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=231&old_menu_id=231&ssm=1″>Auditorium</option>

<option value=”http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=232&old_menu_id=232&ssm=1″>Canteen</option>

</select>
<input type=”button” onClick=”location=document.jump.menu.options[document.jump.menu.selectedIndex].value;” value=”GO”>
</form>

but i keep getting the error

document.jump.menu is null or not an object

Can anyone help me please

David robertson

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsJul 24.2006 — [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
</head>

<body>
<form name="jump">
<select name="menu">
<option value="http://www.vicsjavascripts.org.uk">Administration</option>

<option value="http://www.js-examples.com">Auditorium</option>

<option value="http://www.codingforums.com">Canteen</option>

</select>
<input type="button" onClick="window.top.location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
</form>

</body>

</html>[/CODE]
Copy linkTweet thisAlerts:
@David_robertsonauthorJul 25.2006 — I tried putting that line of code in but i still get a null or not an object error. what causes this error to be displayed. can the button not grab the http address of the option???
Copy linkTweet thisAlerts:
@LogicianJul 25.2006 — Hi i used a java generator on the web to give me the code

<form name="jump">

<select name="menu">

<option value="http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=230&old_menu_id=230&ssm=1">Administration</option>

<option value="http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=231&old_menu_id=231&ssm=1">Auditorium</option>

<option value="http://forboflooringuk/framework/DesktopDefault.aspx?menu_id=232&old_menu_id=232&ssm=1">Canteen</option>

</select>

<input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">

</form>


but i keep getting the error


document.jump.menu is null or not an object

Can anyone help me please

David robertson[/QUOTE]
I cant replicate that problem, perhaps there's an error in the rest of the HTML. Either way, as the button refers to an element in the same form, the reference: document.jump would be better replaced with: this.form
Copy linkTweet thisAlerts:
@David_robertsonauthorAug 02.2006 — Thanks man, that works now, Legend!!!!!!
×

Success!

Help @David_robertson 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...