Help needed with variables and functions
Hello,
I've got myself into a bit of a pickle with this and help would be greatly appreciated. I'm trying to populate a drop-down list with values dependant upon a selection made in another drop down list. This works. However, the end result is that the user clicks a go button to be taken to the location they selected in the second drop down list. The problem I have is that the address it goes to looks like this: P:\directory\subdirectory\undefined
The script looks like this:
<html>
<head>
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body>
<form name="form1">
<p><select name="sel" size="1" onchange="doit()">
<option value="0"></option>
<option value="1"></option>
</select> <input type="text" size="10" name="text1"> </p>
<p><select name="sel2" onchange="doit2()" size="1">
</select> </p>
<p><input type="Button" onclick="GoThere()" value="Warp"> </p>
</form>
<script language="Javascript">
var myNewOption = new Option("A choice", "0")
var Selected=document.form1.elements['sel']
var Selected2=document.form1.elements['sel2']
document.form1.sel.options[0] = myNewOption;
function doit(){
var myNewOption2 = new Option("Two", "address.htm")
var myNewOption3 = new Option("Three", "anotheraddress.htm")
if (Selected.selectedIndex==0);
{
document.form1.sel2.options[0] = myNewOption2
}
if (Selected.selectedIndex ==1);
{
document.form1.sel2.options[1] = myNewOption3
}
}
function doit2(){
var myNewOption4 = new Option ("Four","3")
if (Selected2.selectedIndex ==1);
{
document.form1.sel.options[1] = myNewOption4
document.form1.sel.options[0] = myNewOption
}
}
function GoThere(){
location.href = document.form1.sel2.selectedIndex.value
}
</script>
</body>
</html>
Help!
Cheers
Interrupt
__________________
\'sync\' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
|