Click to See Complete Forum and Search --> : Function/SelectedIndex


hard2figure
03-01-2003, 08:02 PM
:confused:

I'm having a very difficult time with JavaScript. I am new to it and I just can't grab the concept. One of the things I'm having trouble with are functions and selectedIndexes.

For example,

what would I write if I was asked to do the following

"write a function named jump_to_link(weblist)
"within the function, create a variable named url_number that is equal to the selectedIndex property of the weblist variable"

I had the following but its not working.

function jump_to_link(weblist)}
var url_number=selectedIndex(weblist).value
url_number[0]="http://yoga.htm"
also I'm suppose to create a URL to <a> tags that runs a JavaScript command to reload the Web page. I understood that to mean that I should put the following in quotations marks select name="a href#"

Can anyone help?

Jona
03-01-2003, 08:36 PM
url_number=document.formName.selectBoxName[document.formName.selectBoxName.options.selectedIndex].value;

<option value="#"> Should reload the page

hard2figure
03-02-2003, 09:23 AM
:eek:

Thank you Dave Clark and Jona for your feedback. I really do appreciate it. I do believe that the information I recv'd helped however, I have one last question;

"How would I set the location object equal to the value of the selected option in the weblist field, if the selected option has the object name weblist.options[url_number]?"

Please reply!!!!!!!!!!!

Thanks again guys, you're awesome!

hard2figure
03-02-2003, 03:43 PM
:D :) ;) :cool:

Thanks again. I had the =weblist.options[url_number].value; part right but the stuff before the = was definitely incorrect.

It works now.

Thanks alot. I'm not sure I can handle JavaScript. It's too complicated.

Once again you saved me and I appreciate that. Take care and God Bless!

peachyles
09-03-2006, 05:49 PM
What was the solution for the 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]?

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