正在加载图片...
对象 第3章 VBScript脚本语言 例3-1-1 <HTML> <SCRIPT language=VBScript"> Sub but ton1 Onclick 判断用户名是否为空 If Trim(my form username value)= Empty Then document myform elements(0). focus( MsgBOx"用户名不能为空! 判断用户密码是否正确 If Trim(myform. Passl value)=Empty Then document myform elements(1).focus( sgBox"密码不能为空! Exit Sub Else If len(myform Pas sl value)>12 Then document myf e lements (1). focus() MsgBox"密码不能超过12个字符!" Exit Sub Else If len(myform Pas sl value)<6Then document myform elements (1). focus( MsgBox"密码不能小于6个字符 Exit sub End if myform Submit End sub </SCRIPT> FORM name="myform me thod="post action="checklogin asp"> <p>4E: <INPUT name="username"type="text" id="username"></ <p>2h: <INPUT name="pass1" type="password"id="pass1"></p> <p><INPUT type="button"name="button" id=button value=Ex <INPUT type="reset" name="Submit2"value="HH"></p>第 4 章 Response 与 Request 对象 7 第 3 章 VBScript 脚本语言 例 3-1-1: <HTML> <HEAD> <SCRIPT language="VBScript"> Sub button1_OnClick '判断用户名是否为空 If Trim(myform.username.value) = Empty Then document.myform.elements(0).focus() MsgBox "用户名不能为空!" Exit Sub End if '判断用户密码是否正确 If Trim(myform.Pass1.value) = Empty Then document.myform.elements(1).focus() MsgBox "密码不能为空!" Exit Sub Else If len(myform.Pass1.value)>12 Then document.myform.elements(1).focus() MsgBox "密码不能超过 12 个字符!" Exit Sub Else If len(myform.Pass1.value)<6 Then document.myform.elements(1).focus() MsgBox "密码不能小于 6 个字符!" Exit Sub End If End if End if myform.Submit End Sub </SCRIPT> </HEAD> <BODY> <FORM name="myform" method="post" action="checklogin.asp"> <p>名称:<INPUT name="username" type="text" id="username"> </p> <p>密码:<INPUT name="pass1" type="password" id="pass1"> </p> <p><INPUT type="button" name="button1" id=button1 value="提交"> <INPUT type="reset" name="Submit2" value="重置"> </p> </FORM> </BODY> </HTML>
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有