I am attempting to give the user a drop down menu box and have them select one of three options. Then click on the continue image and be sent to a certain page depending on what choice they have made... Here is my code:
with "former" being the name of the form and "word" being the name of the drop down menu...
<script>
function getit() {
if ((document.former.word.value = "test1")){window.location = "index.html"}
else if ((document.former.word.value = "test2")) {window.location = "index1.html"}
else if ((document.former.word.value = "test3")) {window.location = "index2.html"}
}
</script>
I can only get it to send the user to index.html... any suggestions??? Thanks!
ok - I guess the problem was not in the JS but actually part of the form object. Apparently I needed to add values to each of the menu options for it to work properly... all good now - thanks...
actually I put those extra "="'s into the statements and it didn't work at all... the word "test1" etc. wasn't exatly a word the the user would enter but rather one of the options on the menu. So instead of referencing "test 1" as the value, I now actually entered a value (in the code) of 1... confusing but it works properly now! thanks!
Originally posted by Hundley actually I put those extra "="'s into the statements and it didn't work at all... the word "test1" etc. wasn't exatly a word the the user would enter but rather one of the options on the menu. So instead of referencing "test 1" as the value, I now actually entered a value (in the code) of 1... confusing but it works properly now! thanks!
Thats strange because 1 = sign applys the left side to the right side. It doesn't (or shouldn't) evaluate anything
ok - messed with this code a little more... the problem, I believe, has something to do with the form object. I think this because when I change the list/menu form to a text field everything works properly in both IE and NS... what do you think?
Bookmarks