M
M.C
I encoutered a problem which almost drove me crazy, but let me skip my
personal problem, and show you this really strange problem.
msdn.microsoft.com told me that selected is a boolean attribute
with "false" as its default value.However, unfortunately, I found that
not only "selected" was "true" when I assigned "false" to it, but also
remained "true" all the time even when I tried to change it to "false".
here go the codes:
<body>
<form >
<select >
<option id="op" value="initialValue" selected="false">op</option>
<select>
</form>
<script>
function fun(){
op.value="modifiedValue";
var bool=(1==2);
op.selected=bool;
alert("op.selected is "+op.selected + " op.value is "+op.value);
}
fun();
</script>
</body>
I have tried to find some explanation by google but without any
result, I appriciate it if you tell me why or where i am wrong.
thank you!
personal problem, and show you this really strange problem.
msdn.microsoft.com told me that selected is a boolean attribute
with "false" as its default value.However, unfortunately, I found that
not only "selected" was "true" when I assigned "false" to it, but also
remained "true" all the time even when I tried to change it to "false".
here go the codes:
<body>
<form >
<select >
<option id="op" value="initialValue" selected="false">op</option>
<select>
</form>
<script>
function fun(){
op.value="modifiedValue";
var bool=(1==2);
op.selected=bool;
alert("op.selected is "+op.selected + " op.value is "+op.value);
}
fun();
</script>
</body>
I have tried to find some explanation by google but without any
result, I appriciate it if you tell me why or where i am wrong.
thank you!