一个javaScript小问题,就是解决不了

来源:百度知道 编辑:UC知道 时间:2024/05/20 20:32:56
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<script type="text/javascript">
<!--
alert(document.getElementByI("contactForm").firstName.value);//为什么这一行老是提示缺少对象,我试了好几个办法,照着书上说的调用表单中的元素,就是不管用
//-->
</script>
<form id="contactForm" action="">
<fieldset>
<legend>Contact Details</legend>
<label for="firstName">
First Name:
</label>
<input id="firstName" name="firstName" value="Arthur" />
<label for="lastName">
Last Name:
</label>
<input id="lastName&qu

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
</head>
<body>
<script type="text/javascript">
<!--
function clk(){ // 添加一个函数
alert(document.getElementById("firstName").value);//为什么这一行老是提示缺少对象,我试了好几个办法,照着书上说的调用表单中的元素,就是不管用
}
//-->
</script>
<form id="contactForm" action="">
<fieldset>
<legend>Contact Details</legend>
<label for="firstName">
First Name:
</label>
<input id="firstName" name="firstName" value="Arthur" />
<label for="lastName">
Last Name:
</label>
<input id="lastName" name="lastName" value="Dent" />
</fieldset&