html combobox select控件设置默认选项

就想找个设置html combobox或者select默认选项的代码,百度搜了半小时不知所云的内容,其实很简单,代码如下

js的方式:

var index = 你的下标

getElementById("id").selectedIndex= index ;

 

jqurey的方式:

var index = 你的下标

$("#id")[0].selectedIndex = index;

 

posted @ 2015-11-30 18:21  奥雷连诺  阅读(2045)  评论(0编辑  收藏  举报