新手求助!Javascript教程中change事件例子的疑惑!送分帖!
change事件的例子说明:
在下面的例子中,可在一个下拉框中选择身份,只要改变了选择,JavaScript可以截取这个改变,并调用函数,给出用户需要的信息。例:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> goclass </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script language= "JavaScript " type= "text/javascript ">
<!--
function goclass(oneform)
{
oneform.stposition.value=oneform.st.options.value;
}
//-->
</script>
</HEAD>
<BODY>
<form name= "myform ">
<p>
各年级同学报名地点
</p>
<b> 请选择您所在的年级 </b> <br />
<select name= "st " onechange= "goclass(document.myform) ">
<option value= "一教五楼 "> 2000级的同学 </option>
<option value= "一教六楼 "> 99级的同学 </option>
<option value= "求是广场 "> 98级的同学 </option>
<option value= "三教一楼 "> 97级的同学 </option>
</select>
报名地点在 <input type= "text " name= "stposition " value= "一教五楼 " />
</form>
</BODY>
</HTML>
新手学习中,期望前辈指出错误之处!
------解决方案-------------------- <select name= "st " onechange= "goclass(document.myform) ">
改成
<select name= "st " onchange= "goclass(document.myform) ">
写错了,不是onechange