background image

解决方法:使用 srcObj = event.srcElement ? event.srcElement : event.target; 

如 果 考 虑 第 8 条 问 题 , 就 改 用 myEvent 代 替 event

 

即 可 。

window.location.href

 

问 题 说 明 : IE 或 者 Firefox2.0.x 下 , 可 以 使 用 window.location 或

window.location.href ; Firefox1.5.x 下 , 只 能 使 用 window.location

 

 

解决方法:使用 window.location 

 

来代替 window.location.href。当然也可以考虑使用 

location.replace()

 

 

问题说明:IE 下,可以通过 showModalDialog 和 showModelessDialog 打开模态和

Firefox

 

 

解决方法:直接使用 window.open(pageURL,name,parameters) 

 

方式打开新窗口。

 

如 果需要将子窗口中的参数传递回父窗口,可以在子窗口中使用 window.opener 来访

 

问 父 窗 口 。 如 果 需 要 父 窗 口 控 制 子 窗 口 的 话 , 使 用 var   subWindow   = 

window.open(pageURL,name,parameters);  

 

来 获 得 新 开 的 窗 口 对 象 。

frame

iframe

 

frame

 

(1)

访

frame

 

IE : 使 用 window.frameId 或 者 window.frameName 来 访 问 这 个 frame

 

对 象 ;

Firefox : 使 用 window.frameName 来 访 问 这 个 frame

 

对 象 ;

 

解决方法:统一使用 window.document.getElementById(”frameId”) 来访问这个

frame

 

(2)

frame

 

 

在 IE 和 Firefox

 

中都可以使用 window.document.getElementById(”frameId”).src 

= “webjx.com.html”  

或 window.frameName.location = “webjx.com.html”来切换

frame

 

如果需要将 frame 中的参数传回父窗口,可以在 frame 中使用 parent 关键字来访问父

 

body

 

问题说明:Firefox 的 body 对象在 body 标签没有被浏览器完全读入之前就存在;而 IE