2011-04-27 69 views
0

我是一名編程初學者。我創建了一個帶有文本框,文本區域,選擇框,複選框和單選按鈕的HTML頁面。我試圖展示VBScript如何與HTML一起工作來進行類分配。其中一項任務是制定一系列編輯規則。我需要幫助的是確保在用戶提交表單之前至少檢查一個複選框。我怎麼會在VBScript中做到這一點?Vbscript和HTML複選框,幫助?

這是到目前爲止我的代碼:

<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> 
+1

沒有違法意圖克里斯塔,你沒有問,但.....你應該使用Javascript。 – Cheeso 2011-04-28 18:05:00

回答

1
If (f1.rb.checked = True) Or (f1.game.checked = True) Then