<body>
<p>Tell Me About Yourself</p>
<br>
<form action="/action_page.php">
What is Your Name? <input type="text" name="name">
<br>
How old are you? <input type="text" name="old">
<br>
<p>What are your favorite subjects?</p>
<select name="subjects" size="3" multiple="multiple">
<option value="Math">Math</option>
<option value="Science">Science</option>
<option value="English">English</option>
<option value="History">History</option>
<option value="Art">Art</option>
<option value="Music">Music</option>
<option value="Social Studies">Social Studies</option>
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
<option value="Biology">Biology</option>
</select>
<form action=""method="get">
<p>Are you a boy ot a girl?</p>
<br>
<input type="radio"name="gender"value="girl"/>a girl
<input type="radio"name="gender"value="boy"/>a boy
<p>About My Web Site</p>
<form action=""method="get">
<p>What were your favorite pages?</p>
<input type="checkbox"name="page"value="home"/>Home
<input type="checkbox"name="page"value="about"/>About
<input type="checkbox"name="page"value="school"/>School
<input type="checkbox"name="page"value="hobbies"/>Hobbies
</p>
</form>
<form action=""mathod="get">
<p>please leave comment</p>
<textarea name="comments"/></textarea>
<p>
</form>
<input type="submit">
<input type="reset">
</body>
</html>
一个简单的调查问卷,望采纳
function getRadioValue(type) {var temp = document.getElementsByName(type)
var idStr = ""
for (var i = 0i <temp.lengthi++) {
if (temp[i].checked) {
var intHot = temp[i].value
idStr += intHot + ","
}
}
return idStr.substring(0, idStr.length - 1)
}
//这个代码是获取radio value 值的。这个也可以用在checkbox 上。是一个通用的函数。 type 就是你的radio name="sex" , 传进入 "sex" ,就能获取value 值。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)