| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1694 人关注过本帖
标题:一个简单程序点击发送按钮怎么没显示?
只看楼主 加入收藏
yqiong
Rank: 1
等 级:新手上路
帖 子:315
专家分:0
注 册:2007-7-4
结帖率:83.33%
收藏
 问题点数:0 回复次数:7 
一个简单程序点击发送按钮怎么没显示?

<html>
<head>
<title>无标题文档</title>
<script language="vbscript">
sub datacheck()
if document.reg.name.value="" then
msgbox "姓名不得为空!"
exit sub
end if
if document.reg.email.value="" then
msgbox "电子邮件不能为空!"
exit sub
elseif instr(document.reg.email.value,"@")=0 then
msgbox "你输入的电子邮件不合法!"
exit sub
end if
end if
if document.reg.message.value="" then
msgbox "你还没输入信息呢!"
exit sub
end if
document.reg.submit
end sub
</script>
</head>

<body>
<center><img border="0" src="GBook.gif" width="215" height="71"></center><br>
<center><a href="index.asp"><font size="3">返回主页</font></a>
&nbsp;<a href="index.asp"><font size="3">查看留言板 </font></a></center><br />
<center><form method="post" action="reg.asp" name="reg">
<table border="2" cellpadding="15" cellspacing="0" width="500" bordercolor="#686898">
<tr><td colspan="3" rows="2" bgcolor="#96e1ff" height="48"><center><font color="red">注意:带*项的是必须填写的内容</font></center></td></tr>
<tr><td align="center">
<table border="0" cellpadding="0" cellspacing="0" height="326">
<tr><td height="25"><img src="buttom-b(1).gif" width="16" height="16" >
<font color="red">*</font>你的姓名:</td>
<td colspan="2" align="left"><input type="text" size="37" name="name" ></td></tr>
<tr><td height="25"><img src="buttom-b(1).gif" width="16" height="16" >
<font color="red" >*</font>你的性别:</td>
<td align="left"><input type="radio" name="sex" value="male" checked="checked" >男</td>
<td align="left"><input type="radio" name="sex" value="female" checked="checked" >女</td></tr>
<tr><td height="25"><img src="buttom-b(1).gif" width="16" height="16" >
<font color="red">*</font>你的职业:</td>
<td align="left" colspan="2"><select size="1" name="job">
<option selected="selected">教育业
<option >金融业
</select></td></tr>
<tr align="left"><td height="25" align="left"><img src="buttom-b(1).gif" width="16" height="16" >电子邮件:</td>
<td colspan="2" align="left"><input name="email" size="37" /></td></tr>
<tr><td height="25" align="left"><img src="buttom-b(1).gif" width="16" height="16" >网页地址:</td>
<td colspan="2" align="left"><input type="text" size="37" name="html" value="http://"></td></tr>
<tr><td height="25" colspan="3" align="left"><img src="buttom-b(1).gif" width="16" height="16" >
<font color="red">*</font>留言:</td></tr>
<tr><td colspan="3"><textarea name="message" cols="40" rows="5"></textarea></td></tr></table></td></tr>
<tr><td colspan="3" rows="2" bgcolor="#96e1ff" height="48">
<center><input type="button" name="submit" value="发送" onClick="datacheck">
<input type="reset" name="reset" value="清除" >
</center></td></tr></table></form>
</body>
</html>

[此贴子已经被作者于2007-8-23 21:06:11编辑过]

搜索更多相关主题的帖子: 电子邮件 document 按钮 sub 
2007-08-23 21:02
yqiong
Rank: 1
等 级:新手上路
帖 子:315
专家分:0
注 册:2007-7-4
收藏
得分:0 

怎么显示成这样啊?试过几次都不行,只好麻烦各位点击在新窗口中查看了,
代码直接复制到DW就能运行

2007-08-23 21:07
Kettyjin1983
Rank: 1
等 级:新手上路
帖 子:303
专家分:0
注 册:2007-8-17
收藏
得分:0 

我水平不高.不过我觉得是这样的.
在<input type="button" name="submit" value="发送" onclick="datacheck()">里,把button改成Submit试下吧.

2007-08-24 13:09
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 

楼上说对了


[编程论坛] ASP超级群:49158383  敲门暗号:ASP编程
龍艺博客 http://www.
2007-08-24 13:28
yqiong
Rank: 1
等 级:新手上路
帖 子:315
专家分:0
注 册:2007-7-4
收藏
得分:0 
以下是引用Kettyjin1983在2007-8-24 13:09:52的发言:

我水平不高.不过我觉得是这样的.
在<input type="button" name="submit" value="发送" onclick="datacheck()">里,把button改成Submit试下吧.

不一样吗?
用button控件的话事件是onclick;用submit控件的话事件就是onsubmit。有错吗?

2007-08-26 22:58
yqiong
Rank: 1
等 级:新手上路
帖 子:315
专家分:0
注 册:2007-7-4
收藏
得分:0 
以下是引用Kettyjin1983在2007-8-24 13:09:52的发言:

我水平不高.不过我觉得是这样的.
在<input type="button" name="submit" value="发送" onclick="datacheck()">里,把button改成Submit试下吧.

你运行出来了吗?我怎么还是不能正确运行呀!

2007-08-26 23:00
hmhz
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:30
帖 子:1890
专家分:503
注 册:2006-12-17
收藏
得分:0 
你这个是把简单的东西非得变复杂了,在<form>做验证不可以吗?非得在提交按扭上做

提交按扭用Submit是不会出错的,它就是表单原始的提交元素,你使用button已经改变了按扭的用意

再说,我看了你的代码,你那个datacheck()里所处理的只是验证,并没有处理提交事件,所以你再怎么点也不会有反应,并且连验证都不会发生效应


[编程论坛] ASP超级群:49158383  敲门暗号:ASP编程
龍艺博客 http://www.
2007-08-27 08:00
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 

if document.reg.email.value="" then
msgbox "电子邮件不能为空!"
exit sub
elseif instr(document.reg.email.value,"@")=0 then
msgbox "你输入的电子邮件不合法!"
exit sub
end if
end if -------这里多了个end if

<input type="button" name="submit1" value="发送" onclick="datacheck()">

2007-08-27 10:23
快速回复:一个简单程序点击发送按钮怎么没显示?
数据加载中...
 
   



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

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