<body onload=document.all.sel.selectedIndex=-1>
<select name=sel>
<option>1</option>
<option>2</option>
</select>

解决方案 »

  1.   

    如果我的select名字不确定,因为我的form里面有动态的表格,里面的select 名字可能是select_1,select_2,select_3 ......,该怎么办,怎么能让表单里所有的select的selectedIndex都等于-1,谢谢!
      

  2.   

    <body onload=inital()>
    <script>
    function inital(){
     var sels=document.getElementsByTagName("SELECT");
     for(i=0;i<sels.length;i++)
       sels[i].selectedIndex=-1;
    }
    </script>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
      

  3.   

    如果我用样式引用,让select的selectedIndex=-1该怎么定义哪?
      

  4.   

    <style>
    select {qswh:expression(selectedIndex=-1)}
    </style>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
      

  5.   

    不过这样就没法选了,除非用脚本removeExpression建议用
    <style>select{behavior:url(1.htc)}</style>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
    <select >
    <option>1</option>
    <option>2</option>
    </select>
    1.htc内容
    <attach event="oncontentready" handler="doInit" />
    <script>function doInit() {element.selectedIndex=-1}</script>