专题文章
时长:00:00更新时间:2020-11-27 19:38:39
js实现。1.通过让第i个option为selected实现选中第i个,代码如下:(id为下拉框id)。(1) document.getElementById(";id";).options[i].selected=true。(2)document.getElementById(";messagetoid";).selectedIndex = 1;(选中第1个option)。2.通过判别option的value值来实现,代码如下:document.getElementById(";messagetoid";).value=";";(选中value值为空的option)。jQuery实现。
查看详情