js操作select的常用方法
//添加 var Select1= document.getElementById("Select1"); 1.Select1.options[0]=new Option('a','0'); 或 2.Select1.options.add(new Option('a','0')); 其中1的options[0],0是索引,所以好一点 //获取当前的value值 var www=Select1.value; //获取当前的text值 var w=Select1.options[Select1.selectedIndex].text; //动态删除select中的所有options Select1.options.length=0; //动态删除select中的某一项option: Select1.options.remove(indx); //获取value Select1.options[Select1.selectedIndex].value //获取value Select1.options[Select1.selectedIndex].text
机器人 2008年5月26日 15:47 整理于 北京
小师父,我在你这注册了,如果我发表评论的时候,为什么不会默认为renxian呢?
当时做的比较粗,没有考虑这么全,是应该默认显示登录用户。。谢谢提醒!!