Click to See Complete Forum and Search --> : Drop down select issue with Netscape


florida
12-12-2003, 10:35 AM
my Drop down select pulls up a page when selected without hitting any submit button.
It works in my IE but not in my Netscape 4.77 browser. In Netscape 4.77 it gives me a page error saying page cannot be found.

Please advise.


<form name="test">
<SELECT NAME="view" SIZE="1" onChange="document.location=this.value">
<OPTION VALUE="http://webserver/pageOne.cfm">View Page One</OPTION>
<OPTION VALUE="http://webserver/pageTwo.cfm">View Page Two</OPTION>
</SELECT>

</form>



I also tried:

<form name="test">
<SELECT NAME="view" SIZE="1" onChange="document.location=test.view.value">
<OPTION VALUE="http://webserver/pageOne.cfm">View Page One</OPTION>
<OPTION VALUE="http://webserver/pageTwo.cfm">View Page Two</OPTION>
</SELECT>

</form>

olerag
12-12-2003, 10:43 AM
I believe you'll need to iterate thru the selection list.

Below is some example code that puts the selected item's
value into an alert. You can change it to fit your requirements. Tested with IE5,6 and Net 4.7x,7x.


<html>
<head>
<script type="text/javascript">
function showSelected(listObj) {
for (var i=0;i<listObj.length;i++) {
if (listObj.options[i].selected) {
alert("Value: " + listObj.options[i].value);
break;
}
}
}
</script>
</head>
<body>
<center>
<b>Selection Test</b>
<p>
<form>
<select name="selectList1" size="1" onChange="showSelected(this)">
<option value="URL 1">Item #1</option>
<option value="URL 2">Item #2</option>
<option value="URL 3">Item #3</option>
<option value="URL 4">Item #4</option>
</select>
</form>
</center>
</body>
</html>

olerag
12-12-2003, 10:51 AM
Sorry - the previous function can be replaced with this if you
also add a "non-entry" list item as the first value so nothing
is initally depicted...


function showSelected(listObj) {
var val;
for (var i=0;i<listObj.length;i++) {
if (listObj.options[i].selected) {
val = listObj.options[i].value;
if (val.length > 0) {
alert("Value: " + val);
}
break;
}
}
}


Support html for the selection list is...
<select name="selectList1" size="1" onChange="showSelected(this)">
<option value=""></option>
<option value="URL 1">Item #1</option>
<option value="URL 2">Item #2</option>
<option value="URL 3">Item #3</option>
<option value="URL 4">Item #4</option>
<option value="URL 5">Item #5</option>
<option value="URL 6">Item #6</option>
<option value="URL 7">Item #7</option>
</select>

florida
12-12-2003, 11:54 AM
Thanks!