根据我的代码,我想显示数据表单,但我在输入元素单选框和选择框处卡住了。或者我的js
函数有什么错误?有人能解释并修复它吗?
<html>
<head>
<title>Form Example</title>
<script LANGUAGE="JavaScript" type="text/javascript">
function display() {
DispWin = window.open('','NewWin', 'toolbar=no,status=no,width=300,height=200')
message = "<ul><li><b>NAME: </b>" + document.form1.yourname.value;
message += "<li><b>ADDRESS: </b>" + document.form1.address.value;
message += "<li><b>Polling: </b>" + document.form1.webpol1.value;
message += "<li><b>PHONE: </b>" + document.form1.phone.value + "</ul>";
DispWin.document.write(message);
}
</script>
</head>
<body>
<h1>saksake</h1>
hiyahiyahiyahiyahiyahiyahiyahiyahiyahiyahiyahiyahiyahiyahiya
<form name="form1">
<p><b>Name:</b> <input TYPE="TEXT" SIZE="20" NAME="yourname">
</p>
<p><b>Address:</b> <input TYPE="TEXT" SIZE="30" NAME="address">
</p>
<p><b>Phone: </b> <input TYPE="TEXT" SIZE="15" NAME="phone">
</p>
<p><b>Skala polling : </b><br/>
<input id="poll" type="radio" name="webpol1" value="bosok" />bosok<br/>
<input id="poll"type="radio" name="webpol2" value="mayan"/>mayan<br/>
<input id="poll" type="radio" name="webpol3" value="apik" />apik<br/>
</p>
<p><input TYPE="BUTTON" VALUE="Display" onClick="display();"></p>
</form>
</body>
</html>
在这种情况下,无线电组的名称应该相同。你需要写:
<input id="poll" type="radio" name="webpol" value="bosok" />bosok<br/>
<input id="poll"type="radio" name="webpol" value="mayan"/>mayan<br/>
<input id="poll" type="radio" name="webpol" value="apik" />apik<br/>