Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using button to link to another page 1

Status
Not open for further replies.

codehead

Programmer
Aug 25, 1999
96
US
Hello All:

I am creating a prototype in HTML and I am trying to use Javascript to simulate a function. The Javascript is simply loading another page, depending on what the user selects in my form.

The code below works *perfectly* in IE 5.5, but won't work at all in our "flavor" of NN 4.08:

Code:
<script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>

function GoToSelectedWindow()

{
	formObj = document.PES_Form;
	
	if ( formObj.ParcelElementSelect.value == &quot;4&quot; )
	{
		location.href = &quot;LetterMatrix.html&quot;
	} 
	
	if ( formObj.ParcelElementSelect.value == &quot;6&quot; )
	{
		location.href = &quot;AppraisalEntryForm.html&quot;
	} 
	
	if ( formObj.ParcelElementSelect.value == &quot;9&quot; )
	{
		location.href = &quot;LetterMatrix.html&quot;
	} 
	
	if ( formObj.ParcelElementSelect.value == &quot;10&quot; )
	{
		location.href = &quot;TabEntryForm.html&quot;
	} 

}

</script>

<FORM name=&quot;PES_Form&quot; id=&quot;PES_Form&quot;>

Select an element to add<select name=&quot;ParcelElementSelect&quot;>
<option value=&quot;1&quot; SELECTED>Please select an element to add</option>
<option value=&quot;2&quot;>Cover Page</option>
<option value=&quot;3&quot;>Portfolio Commentary Tab</option>
<option value=&quot;4&quot;>Portfolio Commentary</option>
<option value=&quot;5&quot;>Appraisal Tab</option>
<option value=&quot;6&quot;>Appraisal</option>
<option value=&quot;7&quot;>Facts & Opinions Tab</option>
<option value=&quot;8&quot;>Facts & Opinions</option>
<option value=&quot;9&quot;>Putnam Update</option>
<option value=&quot;10&quot;>Blank Tab</option>
</select>

<input type=&quot;button&quot; name=&quot;SubmitButton&quot; value=&quot;Submit&quot; onclick=&quot;GoToSelectedWindow()&quot;>
Any assistance will be greatly appreciated!

Sincerely,

Bob

 
Instead of formObj.ParcelElementSelect.value
try:
formObj.ParcelElementSelect.options[formObj.ParcelElementSelect.selectedIndex].value
 
Aperfectcircle:

Thanks for the reply, but I'm not sure how to implement it. Please show me.

Also, since the button doesn't do anything at all, I suspect that it may be something else????

Thanks.

Bob

 
Change:
if ( formObj.ParcelElementSelect.value == &quot;4&quot; )

To:
if ( [red]formObj.ParcelElementSelect.options[formObj.ParcelElementSelect.selectedIndex].value[/red] == &quot;4&quot; )


Test this, and if it works replace all the &quot;formObj.ParcelElementSelect.value&quot; with [red]formObj.ParcelElementSelect.options[formObj.ParcelElementSelect.selectedIndex].value[/red]
 
Right on! You're the best!

B-)

I apologize for being so dense, but I have never seen brackets used like that before! If you have a minute, please explain the logic behind this code (or give me a reference so that I can read up on it....I'll most probably run into this type of issue again).

Heartfelt thanks again!

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top