| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 948 人关注过本帖
标题:[求助]用VBscript写用户注册网页时动态改变网页选项时的问题
取消只看楼主 加入收藏
freeforever
Rank: 4
等 级:业余侠客
威 望:3
帖 子:368
专家分:201
注 册:2005-11-2
结帖率:66.67%
收藏
 问题点数:0 回复次数:1 
[求助]用VBscript写用户注册网页时动态改变网页选项时的问题

下面是代码:
问题是在点选了"填写其它资料..."时网页没有变化,请问怎样设置和修改代码才能让按下"填写其它资料..."时显示此表格,在此只是个示例,没有加入实际内容!这段文字显示出来?

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>用户注册</TITLE>
<script language="VBScript">
<!--
dim strusername
dim strnetname
dim strdegree
dim strmail
dim straddress
dim strpass1
dim strpass2
dim strrnd
dim strcheckrnd
dim stryear
dim strmonth
dim strday
dim strsex

function creatrnd()
randomize time
strrnd=cstr(int((8888*rnd)+1000))
document.form1.txtrndnum.value=strrnd
end function

sub cmdok_onClick()
strusername=trim(document.form1.txtusername.value)
strnetname=trim(document.form1.txtnetname.value)
strpass1=trim(document.form1.txtpass.value)
strpass2=trim(document.form1.txtpassconfilm.value)
stryear=trim(document.form1.txtyear.value)
strmonth=trim(document.form1.txtmonth.value)
strday=trim(document.form1.txtday.value)
strdegree=trim(document.form1.cmbedudegree.value)
strmail=trim(document.form1.txtmail.value)
straddress=trim(document.form1.txtaddress.value)
strcheckrnd=trim(document.form1.txtkey.value)

if len(strusername)=0 then
msgbox "姓名不能为空" ,,"请更正"
exit sub
end if
if len(strnetname)=0 then
msgbox "请检查用户名",,"请更正"
exit sub
end if
if len(strpass1)<6 then
msgbox "密码过短/空密码",,"请更正"
exit sub
end if
if len(strpass2)<6 then
msgbox "确认密码过短/空密码",,"请更正"
exit sub
end if
if len(stryear)=0 then
msgbox "请填写出生年份",,"请更正"
exit sub
end if
if len(strmonth)=0 then
msgbox "请填写出生月份",,"请更正"
exit sub
end if
if len(strday)=0 then
msgbox "请填写出生的具体日期",,"请更正"
exit sub
end if
if instr(1,strdegree,"0") then
msgbox "请选择您的学历",,"错误"
exit sub
end if
if len(strmail)=0 then
msgbox "Email地址不能为空",,"请更正"
exit sub
end if
if len(straddress)=0 then
msgbox "住址不能为空",,"请更正"
exit sub
end if
if len(strcheckrnd)=0 then
msgbox "错误的验证码"
exit sub
end if
if strpass1<>strpass2 then
msgbox "输入的密码不一致",,"请更正"
exit sub
end if
if len(stryear)=0 or cint(stryear)<1900 or cint(stryear)>2006 then
msgbox "出生后应该在1900--2007之间"
exit sub
end if
if cint(strmonth)<cint("1") or cint(strmonth)>cint("12") or len(strmonth)=0 then
msgbox "输入的出生月不正确"
exit sub
end if
if cint(strday)<cint("1") or cint(strday)>cint("31") or len(strday)=0 then
msgbox "输入的出生日不正确"
exit sub
end if
if Instr(strmail,"@")<=0 or Instr(strmail,".")<=0 then
msgbox "Email地址不正确",,"请更正"
exit sub
end if
if cint(strcheckrnd)<>cint(strrnd) then
msgbox "验证码输入不正确",,"请重新输入"
exit sub
end if
dim msgshow
msgshow="姓名:" & strusername & vbcrlf & _
"用户名:" & strnetname & vbcrlf & _
"密码:" & strpass1 & vbcrlf & _
"出生日期:" & stryear & "年" & strmonth & "月" & strday & "日" & vbcrlf& _
"学历:" & strdegree & vbcrlf & _
"Email:" & strmail & vbcrlf & _
"地址:" & straddress
msgbox msgshow
end sub
sub checkother()
if document.form2.other.checked then
document.getElementById("other").innerHTML="隐藏其它资料..."
document.getElementById("adv").style ="block"
end if
end sub

function txtrndnum_onclick()
creatrnd()
end function

sub init()
creatrnd()
hello()
end sub
sub showdate()
window.status=year(date()) & "年" & month(date()) & "月" & day(date()) & "日" & space(2) & time
showdate()
end sub
sub ended()
//msgbox "是否清除使用的Cookie?",4
end sub
sub hello()
dim ihour
ihour=cint(hour(now))
if ihour<6 then
msgbox "太晚了,该休息了!!!"
else
if ihour<8 then
msgbox "早上好!全新的一天开始了!"
else
if ihour<12 then
msgbox "上午好!工作辛苦了!"
else
if ihour<14 then
msgbox "中午好!还在上网吗?"
else
if ihour<18 then
msgbox "下午好!祝你工作顺利!"
else
if ihour<22 then
msgbox "晚上好!祝你玩的愉快!"
else
if ihour<24 then
msgbox "夜深了! 要注意身体呀! 祝你做个好梦!"
end if
end if
end if
end if
end if
end if
end if
end sub
-->
</script>

<BODY onload="init" onunload="ended">
<FORM NAME="Form1">
<p align="center"><font color="#808080" size="5"><b>用户注册页面</b></font>
<table border="0" width="97%" align="center">
<tr>
<td width="100%" align="right">
<p align="right"></td>
</tr>
</table>
<table border="2" width="81%" align="center" height="292">
<tr>
<td width="22%" align="left" height="23"><font color="#808080">姓&nbsp;&nbsp;
名:</font></td>
<td width="13%" height="23"><font color="#808080"><input type="text" name="txtusername" size="40" tabindex="0"></font></td>
<td width="96%" height="23"><font color="#808080">请留下您的真实姓名以便和您联系</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">用户名:</font></td>
<td width="13%" height="23"><font color="#808080"><input type="text" name="txtnetname" size="40" tabindex="1"></font></td>
<td width="96%" height="23"><font color="#808080">请习题使用简洁方便记忆的名称</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">密&nbsp;&nbsp;
码:</font></td>
<td width="13%" height="23"><font color="#808080">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="6" --><input type="password" name="txtpass" size="40" tabindex="2"></font></td>
<td width="96%" rowspan="2" height="52"><font color="#808080">为确保安全请设置至少6位以上的密码,仅限大小写字母和阿拉伯数字</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">密码确认:</font></td>
<td width="13%" height="23"><font color="#808080"><input type="password" name="txtpassconfilm" size="40" tabindex="3"></font></td>
</tr>
<tr>
<td width="22%" align="left" height="25"><font color="#808080">性&nbsp;&nbsp;
别:</font></td>
<td width="91%" colspan="2" height="25"><font color="#808080">
<input type="radio" name="sex1" value="女">女&nbsp;&nbsp;&nbsp;
<input type="radio" name="sex1" tabindex="4" checked value="男">男</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">出生日期:</font></td>
<td width="91%" height="23" colspan="2"><font color="#808080">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators="x." b-value-required="TRUE" i-minimum-length="4" i-maximum-length="4" s-validation-constraint="Greater than or equal to" s-validation-value="1900" s-validation-constraint="Less than or equal to" s-validation-value="2007" --><input type="text" name="txtyear" size="6" tabindex="5" maxlength="4">年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!--webbot bot="Validation" s-data-type="String" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="2" s-validation-constraint="Greater than" s-validation-value="0" s-validation-constraint="Less than or equal to" s-validation-value="12" -->
<input type="text" name="txtmonth" size="3" tabindex="6" maxlength="2"> 月<!--webbot bot="Validation" s-data-type="String" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="2" s-validation-constraint="Greater than" s-validation-value="0" s-validation-constraint="Less than or equal to" s-validation-value="31" --><input type="text" name="txtday" size="3" tabindex="7" maxlength="2"> 日(介于1900.1.1至2006.12.31)</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">学&nbsp;&nbsp;历:</font></td>
<td width="91%" height="23" colspan="2"><select size="1" name="cmbedudegree" tabindex="8">
<option value="0">&#63733;</option>
<option value="研究生">研究生</option>
<option value="本科生">本科生</option>
<option value="中学生">中学生</option>
<option value="小学生">小学生</option>
<option value="学前儿童">学前儿童</option>
</select><font color="#808080">(请选择)</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">E-Mail:</font></td>
<td width="13%" height="23"><input type="text" name="txtmail" size="40" tabindex="9"></td>
<td width="96%" height="23"><font color="#808080">请留正确的Email地址以便和您联系</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">住&nbsp; 址:</font></td>
<td width="39%" height="23"><input type="text" name="txtaddress" size="40" tabindex="10"></td>
<td width="52%" height="23"><font color="#808080">请如实填写</font></td>
</tr>
<tr>
<td width="22%" align="left" height="23"><font color="#808080">请输入验证码:</font></td>
<td width="109%" height="23" colspan="2"><input type="text" name="txtkey" size="12" tabindex="11">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;<input type="text" name="txtrndnum" size="9"><font color="#808080">(单击刷新)</font>
</td>
</tr>
</table>
<table name="adv" border="1" width="81%"align="center" style="display:none">
<tr>
<td>
<p align="center"><font color="#FF0000">
按下&quot;填写其它资料...&quot;时显示此表格,在此只是个示例,没有加入实际内容!</font></td>
</tr>
</table>
</FORM>
<table border="0" width="100%" height="60">
<tr>
<td width="35%" height="56">
<form name="form2" method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p align="right"> </p>
<p align="right"><input type="checkbox" name="other" value="ON" onclick="checkother"><font color="#808080">填写其它资料...</font></p>
</form>
<p align="right"> </td>
<td width="3%" height="56"></td>
<td width="12%" height="56"><font color="#808080">
<INPUT TYPE="submit" NAME="cmdok" VALUE="确 定(&O)" tabindex="12" style="float: right" ></font></td>
<td width="5%" height="56"> </td>
<td width="43%" height="56"><font color="#808080"><input type="reset" value="取 消(&C)" onblur="creatrnd" name="cmdcancel"></font></td>
</tr>
</table>
<hr>
<p align="right"><font color="#808080">Copyright 2007 by freeforever</font></p>
<p align="right"> </p>
</BODY>
</HTML>

GsFCOj0y.rar (3.38 KB) [求助]用VBscript写用户注册网页时动态改变网页选项时的问题


搜索更多相关主题的帖子: VBscript 网页 动态 选项 用户 
2007-04-03 16:26
freeforever
Rank: 4
等 级:业余侠客
威 望:3
帖 子:368
专家分:201
注 册:2005-11-2
收藏
得分:0 
解决了
把要隐藏的放在一个form里
<form name="frmadv" style="display:none">
在checkbox的代码里改变frmadv的style为block就行了

其实我也很无聊!
2007-04-07 10:25
快速回复:[求助]用VBscript写用户注册网页时动态改变网页选项时的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.099349 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved