在ie6,ff3,chrome下测试的
ff,chrome正常
ie6下 name属性应该是设置成功了,后面的2个alert却很奇怪
这是为什么了????
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="tf">
<input id="te" type="text" name="ss" value="123" />
</form>
<script type="text/javascript">
<!--
window.onload=function(){
var te = document.getElementById('te');
var tf = document.getElementById('tf');
te.setAttribute('name', 'key');
alert(te.name)
alert(tf.key)
alert(tf.ss)
}
//-->
</script>
</body>
</html>
ff,chrome正常
ie6下 name属性应该是设置成功了,后面的2个alert却很奇怪
这是为什么了????
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="tf">
<input id="te" type="text" name="ss" value="123" />
</form>
<script type="text/javascript">
<!--
window.onload=function(){
var te = document.getElementById('te');
var tf = document.getElementById('tf');
te.setAttribute('name', 'key');
alert(te.name)
alert(tf.key)
alert(tf.ss)
}
//-->
</script>
</body>
</html>
key
[object HTMLInputElement]
undefinedie8
key
[object HTMLInputElement]
undefined弹出的东西都一样。被你骗了。
我的ie8第二个undefined
第三个[object]
IE6的问题比较多些,性能不高。
在ie tester v0.4下ie6,7,8都有问题
之前是在傲游下也有问题
name 是只读属性,因此更改是不起作用的。