【聚杰网数据库编程】select控件在Mozilla和Opera中的问题
1. Mozilla和Opera都不支持该字体,改掉DTD也是没有效果。测试在Mozilla Firefox1.5, Opera9.0下都是显示成Arial字体。而特殊符号是支持的。
如:
| 以下是引用片段: <body id="www.never-online.net"> <div style="font-family:Webdings">6</div> <div>▼</div> </body> |
可以在不同浏览器打开,就可以看到区别了,以前不常用Webdings字体,现在才发现这个问题,所以以后还是用图片做这些比较好了。
2. 在IE和Opera中添加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.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> |
3.同样的,在删除时,用remove方法,但不同的是不在options对象上删除option,而是在select控件对象上做的操作。代码
| 以下是引用片段: <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> |




