关于获取行外样式 currentStyle 和 getComputedStyle 出现的兼容性问题
关于用“索引”获取字符串每一项出现的兼容性问题;
关于DOM中 childNodes 获取子节点出现的兼容性问题;
关于使用 firstChild,lastChild 等,获取第一个/最后一个元素节点时产生的问题;
关于使用 event对象,出现的兼容性问题;
关于为一个元素绑定两个相同事件:attachEvent/attachEventLister 出现的兼容问题;
关于获取滚动条距离而出现的问题
<script language="JavaScript">var n = 0
function findInPage(str) {
if (str==""){
alert("请输入关键词")
return false
}
var txt, i, found
if (document.all){
// IE
txt = window.document.body.createTextRange()
for (i = 0 i <= n && (found = txt.findText(str)) != false i++) {
txt.moveStart("character",1)
txt.moveEnd("textedit")
}
if (found) {
txt.moveStart("character", -1)
txt.findText(str)
txt.select()
txt.scrollIntoView()
n++
}else{
if (n > 0) {
n = 0
findInPage(str)
}else{
alert("未找到指定内容")
}
}
}else if(document.layers){
if (!window.find(str))
while(window.find(str, false, true))
n++
else
n++
if (n == 0)alert("未找到指定内容.")
}else{
//ff chrome
window.find(str, false, true)
return true
}
return false
}
</script>
在线测试:http://www.scscms.com/html/article/20130826-js-webtxt.html
最简单的是<td >
<input type="hidden" id="mxkmmc" name="mxkmmc" cssClass="width150" />
改为
<td ><input type="hidden" id="mxkmmc" name="mxkmmc" cssClass="width150" />
也就是说input和select标签不要有空格,因为空格对于ie来说不是子元素,对于其他浏览器来说却是,所以得到的结果不是你想要的,欢迎继续提问,望采纳!