📄 function.vbs
字号:
'修改用户密码
sub pwdmodify()
'调用window对象的open方法打开一个浏览器窗口,在窗口中打开文件pwdmodify.asp,并向该文件传递一个参数UserID。
window.open "pwdmodify.htm","修改用户密码","toolbar=no,menu=no,width=300,height=200"
end sub
sub userguanli()
'调用window对象的open方法打开一个浏览器窗口,在窗口中打开文件pwdmodify.asp,并向该文件传递一个参数UserID。
window.location="userguanli.asp"
end sub
'用户登录
sub userlogon()
'通过设置window对象的location属性,在当前窗口中打开用户登录页面
window.location="userlogon.htm"
end sub
'新用户注册
sub newuserlogin()
'通过设置window对象的location属性,在当前窗口中打开新用户注册页面
window.location="newuserlogin.htm"
end sub
'发表新帖子
sub newart()
'通过设置window对象的location属性,在当前窗口中打开发表新帖子页面
window.location="new.asp"
end sub
sub answerart(id)
window.location="answerart.asp?index="& id
end sub
sub deleteart(id)
window.location="deleteart.asp?index="& id
end sub
sub editart(id)
window.location="editart.asp?index="& id
end sub
sub checkpwd()
'判断新密码文本框中的内容是否为空
if document.password.pwd.value="" then
msgbox "新密码不能为空",48,"密码设置错误"
document.password.pwd.focus()
'判断新密码和确认密码的内容是否一致
elseif document.password.pwd.value<>document.password.confirmpwd.value then
msgbox "新密码与确认密码必须相同",48,"密码设置错误"
document.password.pwd.focus()
else
'提交密码修改表单
document.password.submit
end if
end sub
sub newformcheck()
if document.newform.title.value="" then
'当用户名文本框为空时,弹出警告对话框
msgbox "请输入标题",48,"标题"
'将光标定位于一个名为username的表单控件,即输入用户名的文本框
document.newform.title.focus()
elseif len(document.newform.title.value)>20 then
msgbox "帖子标题不超过20个字符!",48,"帖子过长"
document.newform.title.focus()
elseif document.newform.content.value="" then
msgbox "请输入帖子内容",48,"帖子内容"
document.newform.content.focus()
elseif len(document.newform.content.value)>500 then
msgbox "每条帖子内容不超过500个字符!",48,"帖子过长"
document.newform.content.focus()
else
'当用户提交的客户留言表单通过数据验证之后,调用submit方法来提交表单
document.newform.submit
end if
end sub
sub answerformcheck()
if document.answerform.title.value="" then
'当用户名文本框为空时,弹出警告对话框
msgbox "请输入标题",48,"标题"
'将光标定位于一个名为username的表单控件,即输入用户名的文本框
document.answerform.title.focus()
elseif len(document.answerform.title.value)>20 then
msgbox "帖子标题不超过20个字符!",48,"帖子过长"
document.answerform.title.focus()
elseif document.answerform.content.value="" then
msgbox "请输入帖子内容",48,"帖子内容"
document.answerform.content.focus()
elseif len(document.answerform.content.value)>500 then
msgbox "每条帖子内容不超过500个字符!",48,"帖子过长"
document.answerform.content.focus()
else
'当用户提交的客户留言表单通过数据验证之后,调用submit方法来提交表单
document.answerform.submit
end if
end sub
sub editformcheck()
if document.editform.title.value="" then
'当用户名文本框为空时,弹出警告对话框
msgbox "请输入标题",48,"标题"
'将光标定位于一个名为username的表单控件,即输入用户名的文本框
document.editform.title.focus()
elseif len(document.editform.title.value)>20 then
msgbox "帖子标题不超过20个字符!",48,"帖子过长"
document.editform.title.focus()
elseif document.editform.content.value="" then
msgbox "请输入帖子内容",48,"帖子内容"
document.editform.content.focus()
elseif len(document.editform.content.value)>500 then
msgbox "每条帖子内容不超过500个字符!",48,"帖子过长"
document.editform.content.focus()
else
'当用户提交的客户留言表单通过数据验证之后,调用submit方法来提交表单
document.editform.submit
end if
end sub
sub logoncheck()
'用户名不能为空
if document.logonuser.username.value="" then
msgbox "请输入用户名",48,"用户名"
'将光标定位于一个名为username的表单控件,即输入用户名的文本框
document.logonuser.username.focus()
'登录密码不能为空
elseif document.logonuser.password.value="" then
msgbox "请输入登录密码",48,"登录密码"
document.logonuser.password.focus()
else
'当登录表单通过数据验证之后,调用submit方法进行提交
document.logonuser.submit
end if
end sub
sub newusercheck()
if document.newuser.username.value="" then
'当用户名文本框为空时,弹出警告对话框
msgbox "请输入用户名",48,"用户名"
'将光标定位于一个名为username的表单控件,即输入用户名的文本框
document.newuser.username.focus()
elseif document.newuser.password.value="" then
msgbox "请输入登录密码",48,"登录密码"
document.newuser.password.focus()
else
'当用户提交的客户留言表单通过数据验证之后,调用submit方法来提交表单
document.newuser.submit
end if
end sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -