Two Laptop Bag*
The moose likes HTML, CSS and JavaScript and the fly likes problem with OPTION tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "problem with OPTION tag" Watch "problem with OPTION tag" New topic
Author

problem with OPTION tag

Denver Crisostomo
Greenhorn

Joined: Nov 01, 2007
Posts: 7
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

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.


Mike Firkser
Rutgers '84
Joanne Bangasan
Greenhorn

Joined: May 10, 2008
Posts: 11
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);">
...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with OPTION tag
 
Similar Threads
How to get multi-select to display "selected" values when return to jsp page?
<option>
using dynamic drop down multiple time in same page
populate combox with list with default selected value
Null vs empty string