HTML selected="selected" 不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9426528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML selected="selected" not working
提问by jestges
Hi can somebody tell me what is the wrong in the below code?
嗨,有人可以告诉我下面的代码有什么问题吗?
Selected="selected" not working for me.
Selected="selected" 对我不起作用。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<select id="tstselect" name="tstselect" onchange="showselected(this.value);">
<option value="0" >0</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" selected="selected">3</option>
</select>
Thanks in advance
提前致谢
回答by David
You probably have something on your page selecting the value. You mightbe able to quickly verify that if the same value is still selected after changing the order of the options in the html...
您的页面上可能有一些选择该值的内容。您也许能够快速验证在更改 html 中选项的顺序后是否仍然选择了相同的值...
You might want to refer to: Firefox ignores option selected="selected"