<HTML>
<HEAD><TITLE>Forms and Elements</TITLE></HEAD>
<BODY>
<CENTER>
<FORM NAME="frmForm">
<Input Type = "Text" NAME=txtA><p>
<Input Type = "Text" NAME=txtB><p>
<Input Type = "Text" NAME=txtC><p>
<Input Type = "Text" NAME=txtD><p>
<Input Type = "Button" NAME="cmdChange" VALUE="Click Here"><p>
</FORM>
</CENTER>
</BODY>
</HTML>
<SCRIPT LANGUAGE="VBScript">
Sub cmdChange_OnClick
DIM frm
DIM I
DIM zMSG
SET frm = Document.frmForm
For i = 0 to frm.Elements.count - 1
zMSG= "Object " & frm.Elements(i).Name & " is "
& frm.Elements(i).value
MSGBOX zMSG
next
End Sub
</SCRIPT>
Figure 2 Setting the Focus on a Form
<html>
<head>
<script language="vbscript">
<!--
Randomize()
sub focuser()
set form = document.forms("main")
count = form.length
element = int(rnd() * count)
form.elements(element).focus
end sub
-->
</script>
<body onload="focuser()">
<form id="main">
<input type=text value="TextInput">
<br>
Radio Buttons:
<input type=radio name="radio" value=0>
<input type=radio name="radio" value=1>
<input type=radio name="radio" value=2>
<br>
Check Boxes:
<input type=checkbox>
<input type=checkbox>
<input type=checkbox>
<br>
<select>
<option>SelectList</option>
</select>
<br>
<textarea>TextArea</textarea>
<br>
<input type=submit>
</form>
</html>
</body>