PDA

View Full Version : Stupid Netscape 4 won't work a dropdown


souldrifter02
08-22-2002, 12:51 PM
Here's the goal- a simple dropdown list that will allow the user to select an item and it will automatically go there.

Here's the problem- I'm having trouble accessing the selected item in Netscape 4.

Here's the REALLY SIMPLE code:

<script language="JavaScript">
function show(app){
app=app;
if (navigator.appName == "Netscape")
link=app.applications.options[app.applications.selectedIndex].value;
else
link=applications.applications.value;
document.location=link;
}
</script>


<form name="applications">
<select name="applications" onChange="show(this);">
<option value="#">Make a Selection</option>
<option value="build_permit.html">Building Permit</option>
<option value="demolition_permit">Demolition Permit</option>
</select>
</form>


It works fine in IE but Netscape 4 pitches a fit.

Thanks in Advance!

Dr. Web
08-22-2002, 01:17 PM
hmmmn... this works for me in IE and N4/ 6


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body bgcolor=#dfdfdf>
<form style="display:inline">
<select onChange="if(this.selectedIndex!=0){ document.location=this.options[this.selectedIndex].value}">
<option value="" selected>Jump to Section
<option value="http://photos_home.html">------2001------</option>
<option value="http://photos/2001/chall_18.html">Chall's 18th</option>
<option value="http://photos/2001/ed_party.html">Ed's St P Party</option>
<option value="http://photos/2001/newyear2001.html">New Year 2001</option>
</select>
</form>




</body>
</html>

souldrifter02
08-22-2002, 02:09 PM
Thanks a bunch! That was more than sufficient for my purposes! Many thanks!!
-J

Jon Hanlon
08-22-2002, 06:51 PM
Just for the record, I'd say the problem's with the line:
app=app
Here you're trying to set a global variable called 'app' to the parameter value 'app'.
Netscape no like. (Neither does IE4.)

The other thing I'd do is steer well clear of names like 'link' and 'show' when naming variables. Although not reserved words in Javascript, they could well be objects in Netscape's DOM.