midntcowboy25
Baseband Member
- Messages
- 21
LOL, after I put the script section after the html I started getting an object expected error. Unless I put it in the wrong spot.
</script>
<html>
<body>
<form name="form1">
<table border=1>
<tr>
<td>
<select name="dropdn1" OnChange="change_form();">
<option name="val1" value="val1" SELECTED>val1</option>
<option name="val2" value="val2">val2</option>
</select>
</td>
<td>
<div id="formxyz">
<select name="subselect">
<option value="1" name="1">1a</option>
<option value="1" name="1">2a</option>
<option value="1" name="1">3a</option>
<option value="1" name="1">4a</option>
</select>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<script>
function change_form()
{
var el = document.getElementById? document.getElementById('formxyz'): document.all['formxyz'];
var formx1 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1a</option><option value=\"1\" name=\"1\">2a</option><option value=\"1\" name=\"1\">3a</option><option value=\"1\" name=\"1\">4a</option></select>";
var formx2 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1b</option><option value=\"1\" name=\"1\">2b</option><option value=\"1\" name=\"1\">3b</option><option value=\"1\" name=\"1\">4b</option></select>";
if (document.form1.dropdn1.value=="val1")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx1;
}
if (document.form1.dropdn1.value=="val2")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx2;
}
}
Alright there's gotta be something missing in my text above these lines that im missing because I copied this text into a new blank html and it worked. Can you take some time to look at the text up to yours?
</script>
<html>
<body>
<form name="form1">
<table border=1>
<tr>
<td>
<select name="dropdn1" OnChange="change_form();">
<option name="val1" value="val1" SELECTED>val1</option>
<option name="val2" value="val2">val2</option>
</select>
</td>
<td>
<div id="formxyz">
<select name="subselect">
<option value="1" name="1">1a</option>
<option value="1" name="1">2a</option>
<option value="1" name="1">3a</option>
<option value="1" name="1">4a</option>
</select>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
<script>
function change_form()
{
var el = document.getElementById? document.getElementById('formxyz'): document.all['formxyz'];
var formx1 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1a</option><option value=\"1\" name=\"1\">2a</option><option value=\"1\" name=\"1\">3a</option><option value=\"1\" name=\"1\">4a</option></select>";
var formx2 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1b</option><option value=\"1\" name=\"1\">2b</option><option value=\"1\" name=\"1\">3b</option><option value=\"1\" name=\"1\">4b</option></select>";
if (document.form1.dropdn1.value=="val1")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx1;
}
if (document.form1.dropdn1.value=="val2")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx2;
}
}
Alright there's gotta be something missing in my text above these lines that im missing because I copied this text into a new blank html and it worked. Can you take some time to look at the text up to yours?