您现在的位置是:首页 > 电脑技术查询 > web开发

菜鸟请问!

编辑:chaxungu时间:2022-10-02 23:17:39分类:web开发

初学者请教!!!
<html>
<head>
<script><title>I'll go and quit my job in the freedom company!! </title>
function ss()
{
alert(document.Form1.dd.value);
}

</script>
</head>
<body>
<form id="Form1" method="post">
<input type="text" id="dd" onblur="ss()">

</form>
</body>
</html>
报alert(document.Form1.dd.value);这个有错
哪位帮我解决一下

------解决方案--------------------
为什么不直接
HTML codealert(document.getElementById("dd").value);
------解决方案--------------------
表单操作是用name而不是id的,只是ie能兼容两者所以很多时大家都忽略了。把form、input、textarea等的id都改为name是最好的。又或者用比较正道的操作方法如1楼的,又或者是document.forms[xxx].elements[xxxx].value