Vbscript 和 HTML 复选框,有帮助吗?
我是编程初学者。我创建了一个包含文本框、文本区域、选择框、复选框和单选按钮的 HTML 页面。我试图展示 VBScript 如何与 HTML 配合完成课堂作业。其中一项任务是制定一系列编辑规则。我需要帮助的是确保在用户提交表单之前至少选中一个复选框。我该如何在 VBScript 中执行此操作?
到目前为止,这是我的代码:
<html>
<head>
<script language="vbscript">
<!--
sub fred
end sub
-->
</script>
</head>
<body>
<p>
<form name="f1">
<br>
Name <input type="text" name="nametext" size="30"><p>
List your favorite things to do <P><textarea name="bigtext" rows="5" cols="40">default value</textarea>
<p>What is your favorite animal to see at the zoo?
<select name="zooanimal">
<option>default value
<option>elephants
<option>giraffes
<option>tigers
<option>seals
</select>
<p>
What is your favorite color?<br><p>
blue <input name="rb" type="radio" value="bluechecked" checked> green <input name="rb" type="radio" value="greenchecked">
pink <input name="rb" type="radio" value="pinkchecked"> yellow <input name="rb" type="radio" value="yellowchecked"> red <input name="rb" type="radio" value="redchecked"> black <input name="rb" type="radio" value="blackchecked"></p>
Which of these games do you play?<br><p>
Starcraft <input name="game" value="Starcraft" type="checkbox"> World of Warcraft <input name="game" value="WorldofWarcraft" type="checkbox">
League of Legends <input name="game" value="LeagueofLegends" type="checkbox"> none <input name="game" value="none"
type="checkbox"><P>
<p><input type="button" value="EDIT AND REPORT" onClick="fred">
<p>
<p>
</form>
</body>
</html>
I am a beginner with programming. I have created an HTML page with a text box, text area, select box, checkboxes, and radio buttons. I am trying to show how VBScript works with HTML for a class assignment. One of the tasks is to have a series of editing rules. The one I need help with is making sure that at least one checkbox is checked before the user can submit the form. How would I do this in VBScript?
Here is my code so far:
<html>
<head>
<script language="vbscript">
<!--
sub fred
end sub
-->
</script>
</head>
<body>
<p>
<form name="f1">
<br>
Name <input type="text" name="nametext" size="30"><p>
List your favorite things to do <P><textarea name="bigtext" rows="5" cols="40">default value</textarea>
<p>What is your favorite animal to see at the zoo?
<select name="zooanimal">
<option>default value
<option>elephants
<option>giraffes
<option>tigers
<option>seals
</select>
<p>
What is your favorite color?<br><p>
blue <input name="rb" type="radio" value="bluechecked" checked> green <input name="rb" type="radio" value="greenchecked">
pink <input name="rb" type="radio" value="pinkchecked"> yellow <input name="rb" type="radio" value="yellowchecked"> red <input name="rb" type="radio" value="redchecked"> black <input name="rb" type="radio" value="blackchecked"></p>
Which of these games do you play?<br><p>
Starcraft <input name="game" value="Starcraft" type="checkbox"> World of Warcraft <input name="game" value="WorldofWarcraft" type="checkbox">
League of Legends <input name="game" value="LeagueofLegends" type="checkbox"> none <input name="game" value="none"
type="checkbox"><P>
<p><input type="button" value="EDIT AND REPORT" onClick="fred">
<p>
<p>
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)