/    Sign up×
Community /Pin to ProfileBookmark

HELP!! Java is driving me nuts!!

I am new to Java and to be quite honest I am not liking it too much!

If I were asked to create a javascript function named jump_to_link(weblist) and within this function, create a variable named url_number that is equal to the selectedIndex property of the weblist variable; set the location object to the value of the selected option in the weblist field, if the selected option has the object name weblist.options[url_number]; and then to run the function whenever the user selects an item from one of the three selection lists in the form.

This is what I have so far:

function jump_to_link(weblist)
url_number=document.formName.selectBoxName[document.formName.selectBoxName.options.selectedIndex].value
=weblist.options[url_number}.value

Please help!!! Thanks! ?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERSep 04.2006 — To begin with, you have a typo error.

[code=php]
function jump_to_link(weblist)
url_number=document.formName.selectBoxName[document.formName.selectBoxName.options.selectedIndex].value
=weblist.options[url_number}.value
[/code]


should be '[url_number].value' instead
Copy linkTweet thisAlerts:
@CrazyMerlinSep 04.2006 — to start with...

this is not Java....it is javascript...very different.

now look at your function.....toward the end.

you are trying to reference 'url_number' but until the line has been executed, url_number does not exist, as that is the line that creates it.

<i>
</i>document.formName.selectBoxName[document.formName.selectBoxName.options.selectedIndex].value


is wrong...

your selectbox should have an id attribute like:
<i>
</i>&lt;select id='select_1' ...


then you could say:
<i>
</i>var this_select = document.getElementById('select_1');
var url_number = this_select[this_select.selectedIndex].value;


what you do with the url_number after that I have no idea....you have a way to go, but keep going.
×

Success!

Help @peachyles 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.6,
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,
)...