11.1 简单差异
<meta http-equiv="content-type" content="text/html; charset=gb2312"> //或 <meta http-equiv="content-type" content="text/html; charset=utf-8">否则页面调用插件的函数时,参数中的中文很可能会变成乱码.
... function OnReady(id) { AF.func("Build", "g1.xml"); } ... <form name="form1"> <script>insertReport('AF', '')</script> </form> ...IE执行到第4行会抛出 'AF'未定义的错误,此时改成如下写法就能成功:
... function OnReady(id) { form1.AF.func("Build", "g1.xml"); } ...当然,您也可以把 上面insertReport( )的语句移出form,这样就不会有这个问题了。
var b = true; AF.func("GrayWindow", b);发现在 IE 下会有问题: 插件接收到的串居然是 "-1" 了! 这将导致函数执行结果与预期不一致。改成如下就能正常:
AF.func("GrayWindow", String(b)); 或 AF.func("GrayWindow", b + '');Chrome 和 Firefox无此问题,其它数据类型也没有这种问题。
function toFocus() { document.getElementById("source").blur(); document.getElementById("source").focus(); }