我是编程的初学者。我创建了一个带有文本框,文本区域,选择框,复选框和单选按钮的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>
答案 0 :(得分:1)
If (f1.rb.checked = True) Or (f1.game.checked = True) Then