...

View Full Version : noob needs help, select menu, onchange, windows



adamuk
07-15-2004, 09:28 AM
hello people

got a small problem

ive managed to get this peice of code to work to go to a different page when a user selects a certain object,

heres the code


<select name="option" onchange='window.open(this.value,"_self")'>
<option value="SELECT">SELECT</option>
<option value="view.php?id=$id">View</option>
<option value="edit.php?id=$id">Edit</option>
<option value="print.php?id=$id">Print</option>
<option value="parcellabel.php?id=$id&q=insurance&e=true">Insurance </option>
<option value="parcellabel.php?id=$id&q=warranty">Warranty</option>
</select>

this works great but i got the application im building looked at by someone and they said that they want the last 2 options to open in a new window (the links i have put in there end up at a pdf document which is made by the server

is there anyway i can modify this to open the last 2 links in a new window? thanks adam
:thumbsup: :)

Kor
07-15-2004, 12:26 PM
Try:

onchange='if(this.selectedIndex<4){window.open(this.value,"_self")}else{window.open(this.value,"_blank")}'

or

onchange='function(){if(this.selectedIndex<4){window.open(this.value,"_self")}else{window.open(this.value,"_blank")}}'

adamuk
07-15-2004, 02:47 PM
thank you!!

the first one worked a treat!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum