faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

24 of 45 people (53%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I make a drop-down select list in which some selections spawn a new browser window and others do not?

May 2nd, 2000 08:59
Martin Honnen, Joe Hudson,


For such tasks you script the ONCHANGE handler of the SELECT element 
and check the selectedIndex property e.g.:
  <SELECT ONCHANGE="
    if (this.selectedIndex == 1 || 
        this.selectedIndex == 5)
      open(this.options[this.selectedIndex].value);"
  >