- 1、本文档共13页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ie和firefox在javascript方面的兼容性(Compatibility of IE and Firefox in JavaScript)
ie和firefox在javascript方面的兼容性(Compatibility of IE and Firefox in JavaScript)
1.document.formname.item (itemname) 问题
说明:
ie下, 可以使用 document.formname.item (itemname) 或 document.formname.elements [elementname];
firefox下, 只能使用 document.formname.elements [elementname].
解决方法:
统一使用 document.formname.elements [elementname].
text1.
document.formname.item (itemname)
document.formname.elements [elementname]
2.集合类对象问题
说明:
ie下, 可以使用 () 或 [] 获取集合类对象;
firefox下, 只能使用 [] 获取集合类对象.
解决方法:
统一使用 [] 获取集合类对象.
text2.
document. forms (formname)
document. forms [formname]
text3:
document.getelementsbyname (inputname) (0)
document.getelementsbyname (inputname) [0]
3.自定义属性问题
说明:
ie下, 可以使用获取常规属性的方法来获取自定义属性, 也可以使用getattribute () 获取自定义属性;
firefox下, 只能使用getattribute () 获取自定义属性.
解决方法:
统一通过getattribute () 获取自定义属性.
text4:
直接获取自定义属性的值
通过getattribute () 获取自定义属性的值
4.eval (idname) 问题
说明:
ie下, 可以使用eval (idname) 或getelementbyid (idname) 来取得id为idname的html对象;
firefox下只能使用getelementbyid (idname) 来取得id为idname的html对象.
解决方法:
统一用getelementbyid (idname) 来取得id为idname的html对象.
text5:
eval (idname)
document.getelementbyid (itemid)
5.变量名与某html对象id相同的问题
说明:
ie下, html对象的id可以作为document的下属对象变量名直接使用;
firefox下则不能.
firefox下, 可以使用与html对象id相同的变量名;
ie下则不能.
解决方法:
使用 document.getelementbyid (idname) 代替document.idname.最好不要取html对象id相同的变量名, 以减少错误; 在声明变量时, 一律加上var, 以避免歧义.
6.const问题
说明:
firefox下, 可以使用const关键字或var关键字来定义常量;
Under IE, you can only define constants using the VaR keyword
Resolvent:
The unified use of the VaR keyword defines constants
,
7.input.type attribute problem
Explain:
Under IE, the input.type property is read-only, but under Firefox the input.type property is read and write
,
8.window.event problem
Explain:
Window.event can only run under IE and not run under Firefox, because Firefoxs event can only be used at the site of the event
Resolvent:
IE:
input name= Button8_1 type= button value= IE /
...
script language= JavaScript
Function, gotoSubmit8_1 () {
...
Alert (window.event); //use window.event
...
}
/script
IEFiref
您可能关注的文档
- 2011年磷矿石出口配额申报条件及程序的公告(Announcement on the conditions and procedures for the declaration of phosphorus ore export quotas in 2011).doc
- 2011年江西省南昌市中考语文试题及答案(Chinese examination questions and answers in Jiangxi, Nanchang in 2011).doc
- 2011年胡润财富排行榜(Hurun wealth list in 2011).doc
- 2011年陕西高考数学试题及答案(理科)(Mathematics examination questions and answers of Shaanxi college entrance examination in 2011 (Science)).doc
- 2011年青浦区高三化学一模试卷(附答案)(Qingpu District in 2011 the first mock exam papers of Senior Chemistry (with answers)).doc
- 2011微博营销发展方向漫谈(2011, micro-blog marketing development direction).doc
- 2011湖南衡阳物理试题(2011 Hunan Hengyang physics examination).doc
- 2011总结(2011 summary).doc
- 2011申论热点剖析人肉有哪些信誉好的足球投注网站案暴露民事立法之不足(Analysis on 2011 hot spots human flesh search case exposed a lack of civil legislation).doc
- 2011福建高考满分作文(2011 Fujian college entrance examination scores).doc
文档评论(0)