Hi,
I expect to see "foo" for the 2nd alert. Instead, the value of select is
cleared. Am I missing something? Thanks for your help.
<html>
<head><title>Fo o</title>
<script language="javas cript">
<!--
function foo()
{
alert('Before change: ' + document.contro l.titleFont.val ue);
document.contro l.titleFont.val ue = 'foo';
alert('After change: ' + document.contro l.titleFont.val ue);
}
-->
</script>
</head>
<body>
<form name="control" method="POST">
<select name="titleFont ">
<option value="sans-serif">Arial</option>
<option value="serif">T imes</option>
</select>
<input type="submit" name="control" value="Submit" onclick="return
foo()"/>
</form>
</body>
</html>
I expect to see "foo" for the 2nd alert. Instead, the value of select is
cleared. Am I missing something? Thanks for your help.
<html>
<head><title>Fo o</title>
<script language="javas cript">
<!--
function foo()
{
alert('Before change: ' + document.contro l.titleFont.val ue);
document.contro l.titleFont.val ue = 'foo';
alert('After change: ' + document.contro l.titleFont.val ue);
}
-->
</script>
</head>
<body>
<form name="control" method="POST">
<select name="titleFont ">
<option value="sans-serif">Arial</option>
<option value="serif">T imes</option>
</select>
<input type="submit" name="control" value="Submit" onclick="return
foo()"/>
</form>
</body>
</html>
Comment