<html>
<head>
<title></title>
</head>
<body>
<script>
function save(obj)
{
alert(obj.value);
}
function show()
{
var str=document.getElementById('cc').value();
alert(str);
}
</script>
<input type="text" id="bb" onblur="save(this)" />
<input type="text" id="cc" onblur="show()" />
</body>
</html>问题:1 第一个输入框可以取到值,第二个为何就取不到值呢?
2 save(this)中的这个this指的是当前的输入框id为bb吗?
<head>
<title></title>
</head>
<body>
<script>
function save(obj)
{
alert(obj.value);
}
function show()
{
var str=document.getElementById('cc').value();
alert(str);
}
</script>
<input type="text" id="bb" onblur="save(this)" />
<input type="text" id="cc" onblur="show()" />
</body>
</html>问题:1 第一个输入框可以取到值,第二个为何就取不到值呢?
2 save(this)中的这个this指的是当前的输入框id为bb吗?
写错了 应该是valuesave(this) this只当前dom对象
save(this.value)这样写
save(this.value)这样写指的就是输入框的value值了吧 save(this)这样写指的就是输入框的id了 应该没错了哈