在javascript中怎么获取表单中的对象? document.getElementById(id); 此方法哪个字母需要大写

如题所述

<form name="from" actioin="#" method="post">
<input type="text" id="name" />
</form>

<script>
function getValue(){
var name = document.getElementById("name").value;//获取id为name的输入框的值
}
</script>
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-12-15
首先你的document.getElementById(id);是写正确了的,至于如何获取表单中的对象一般使用getElementByTagName方法,如有不明白的再问