html中关于<select>标签如何设置默认选中的选项详解

黄舟
Lepaskan: 2017-07-28 09:18:47
asal
3386 orang telah melayarinya

方法有两种。

第一种通过标签选中项文本的js代码为:

var  val = document.all.Item.options[document.all.Item.selectedIndex].text
var  i=document.getElementById( &#39;sel&#39; ).options[document.getElementById( &#39;sel&#39; ).selectedIndex].value;
Salin selepas log masuk

一些其它操作