摘要: 1. document.form.item 问题(1)现有问题:现有代码中存在许多 document.formName.item("itemName") 这样的语句,不能在Firefox(火狐)下运行(2)解决方法:改用 document.formName.elements["elementName"]2. 集合类对象问题(1)现有问题:现有代码中许多集合类对象取用时使用 (),IE 能接受,Firefox(火狐)不能。(2)解决方法:改用 [] 作为下标运算。如:document.forms("formName") 改为 docum 阅读全文
posted @ 2013-08-07 14:08 金虹巴巴 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 我们经常需要在JavaScript中给Element动态添加各种属性,这可以通过使用setAttribute()来实现,这就涉及到了浏览器的兼容性问题。setAttribute(string name, string value):增加一个指定名称和值的新属性,或者把一个现有的属性设定为指定的值。1、样式问题setAttribute(class, value)中class是指改变class这个属性,所以要带引号。 vName代表对样式赋值。 例如: var input = document.createElement(input); input.setAttribute(type, text) 阅读全文
posted @ 2013-08-07 13:38 金虹巴巴 阅读(257) 评论(0) 推荐(0) 编辑