[javascript]代码库
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>js获取input文本框值的4种方法</title>
</head>
<body>
<FORM NAME="form1">
姓名:
<INPUT TYPE="text" NAME="name" value="刘强">
<BR>
电话:
<INPUT TYPE="text" NAME="tel" value="88166289">
<BR>
</FORM>
<script language="javascript">
document.writeln(document.forms[0].tel.value);
document.writeln(document.form1.tel.value);
document.writeln(document.forms[0].elements[1].value);
document.writeln(document.form1.elements[1].value);
</script>
</body>
</html>