• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with OPTION tag

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys,

I have this problem concerning OPTION tag of SELECT tag..
I have this OPTION tag value "SELECT ITEMS BELOW":
<option>SELECT ITEMS BELOW </option>
<option value="www.google.com"> Google </option>

When I choose Google item and opens a new window, and then I closed it and then choosed the SELECT ITEMS BELOW, it displays an error or undesirable blank page..

My question is, how can I make the page to not do anything when I choose SELECT ITEMS BELOW?

Thanks for your help guys.

Denver
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just selecting a select option isn't going to do anything on its own. How are you effecting the transition to a new page? That's what you need to make sensitive to which option is selected.
 
Ranch Hand
Posts: 249
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My first question is do you call a function on the <select> tag's onchange event. If you do, the "Select Items Below" option has no value, and that may cause the problem.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it something like this?

<select name="mylinks" onchange="window.open(this.value);">
<option>SELECT ITEMS BELOW </option>
<option value="http://www.google.com"> Google </option>
</select>

Maybe it can be added with:
<select name="mylinks" onchange="if (this.selectedIndex > 0) window.open(this.value);">
...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic