| 以下是引用片段: <body id="www.never-online.net"> <div style="font-family:Webdings">6</div> <div>▼</div> </body> |
| 以下是引用片段: <select id="sel"> </select> <script type="text/javascript"> //<![CDATA[ var a=document.getElementById("sel"); var o=new Option("never-online.net","a",false,false); a.add(o); //]]> </script> 但是在Mozilla下是失败的,将抛出异常。如果在Mozilla中动态添加select控件的Option呢?只需要这样 <select id="sel"> </select> <script type="text/javascript"> //<![CDATA[ var a=document.getElementById("sel"); var o=new Option("never-online.net","a",false,false); a.options.add(o); //]]> </script> |
| 以下是引用片段: <select id="sel"> </select> <script type="text/javascript"> //<![CDATA[ var a=document.getElementById("sel"); var o=new Option("never-online","a",false,false); a.options.add(o); alert("你可以看到添加了never-online这个option"); a.remove(0); alert("现在删除添加的option"); //]]> </script> |