大家帮忙看下 下边有原代码 和预览地址 ,怎么我一点发送就跳其他的网页而不提示没有添用户名和成功的信息呢
http://www.carea.cn/ruihe/contact.asp 预览演示地址可能要分3段 小弟实在不知道怎么突出重点就都贴上来了 麻烦大家了
<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
%>
<!-- #include file="mycnstr.asp" -->
<%
set cn=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
classcode="13"
mymenu="contact"
myurl="contact.asp"
keyno=Request.QueryString("keyno")
if keyno="" or not isnumeric(keyno) then keyno="0"
sendok=Request.QueryString("sendok")
sql="select * from contact where id="&keyno&" and pid=13 and cnflag=1"
if keyno=0 then sql="select * from contact where pid=13 and cnflag=1 order by xuhao"
rs.Open sql,cn,1,1
if not rs.EOF then
keyno=rs("id")
keytitle=rs("company")
keytitles=rs("shortcorp")
if trim(keytitles)="" then keytitles=keytitle
if trim(keytitle)="" then keytitle=keytitles
toemail=trim(rs("email"))
keyadd=rs("address")
keyzip=rs("zip")
keytel=rs("tel")
keyfax=rs("fax")
else
Response.Write "对不起,没有相关记录或者该页面已被管理员删除。"
Response.End
end if
rs.Close
if Request.ServerVariables("REQUEST_METHOD") = "POST" and keyno<>0 then
sender = Request.Form("email")
subject = Request.Form("topic")
name = Request.Form("myname")
company = Request.Form("corpname")
address = Request.Form("address")
telphone = Request.Form("phone")
fax = Request.Form("fax")
content=Request.Form("content")
if trim(subject)="" then subject=mid(trim(content),1,8)
if trim(subject)="" then subject="无标题"
toname=keytitles
sqltext="select * from contact"
rs.Open sqltext,cn,1,2
rs.AddNew
rs("id")=getkeyid("contact","id")
rs("pid")=14
rs("title")=subject
rs("toid")=0
rs("toname")=toname
rs("name")=name
rs("email")=sender
rs("company")=company
rs("encompany")=""
rs("address")=address
rs("enaddress")=""
rs("tel")=telphone
rs("fax")=fax
rs("zip")=""
rs("cableadd")=""
rs("content")=content
rs("creatdate")=now()
rs("editdate")=now()
rs.Update
rs.Close
'------------------------------------------------------------------------------------------------------------------------------
website="振兴"
' if trim(toemail)="" then mailmode="" else mailmode="jmail" end if
s_string="姓名:" & name & chr(13) & chr(10) & "时间:" & now() & chr(13) & chr(10) & "公司:" & company & chr(13) & chr(10) & "地址:" & address & chr(13) & chr(10) & "电话:" & telphone & chr(13) & chr(10) & "传真:" & fax
if mailmode="jmail" then
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = "public@ibw.com.cn" '输入smtp服务器验证登陆名
msg.MailServerPassword = "wangxin108" '输入smtp服务器验证密码 (用户Email帐号对应的密码)
if sender="" then
msg.From ="未知"
else
msg.From = sender
end if '发件人Email
msg.FromName = name '发件人姓名
msg.AddRecipient toemail '收件人Email
' msg.AddRecipientBCC "bothwell@ibw.com.cn" '密件传送'
msg.Subject = website&"网站留言"&now() '信件主题
msg.Body = "主题:"&subject&chr(13)&chr(10)&s_string&chr(13)&chr(10)&content '正文
msg.Send ("smtp.sina.net") 'smtp服务器地址(企业邮局地址)
set msg = nothing
end if
Response.Redirect myurl&"?keyno="&keyno&"&sendok=1"
end if
%>
<!--#include file="begin.asp"-->
<table width="1002" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="41%" align="left" valign="top"><img src="images/联系我们/contact_01.gif" width="409" height="122"></td>
<td width="19%" align="left" valign="top"><img src="images/联系我们/contact_02.gif" width="263" height="122"></td>
<td width="40%" align="left" valign="top"><img src="images/联系我们/contact_03.gif" width="329" height="122"></td>
</tr>
</table>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="166" align="left" valign="top"><img src="images/联系我们/contact_04.gif" width="240" height="25"></td>
<td width="836" align="left" valign="top" background="images/about/nav_bj.jpg"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="24"> </td>
<td align="right" valign="middle">
<!--#include file="inc_top_menu.asp"-->
</td>
</tr>
</table></td>
</tr>
</table>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="174" align="left" valign="top"><img src="images/联系我们/contact_06.gif" width="190" height="110"></td>
<td width="188" align="left" valign="top"><img src="images/联系我们/contact_07.gif" width="230" height="110"></td>
<td width="640" align="left" valign="top"><img src="images/联系我们/contact_08.gif" width="581" height="110"></td>
</tr>
</table>
--------------------编程问答-------------------- <table width="1002" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="190" height="25"><img src="images/联系我们/contact_09.gif" width="190" height="25"></td>
<td width="231"><img src="images/联系我们/contact_10.gif" width="230" height="25"></td>
<td width="558" background="images/about/nav__bj.jpg">
<!--#include file="inc_login.asp"-->
</td>
<td width="12"><img src="images/about/nav_2.jpg" width="24" height="24"></td>
</tr>
</table>
<table width="1002" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="190" align="left" valign="top" background="images/about/title_bj.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="16"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="middle"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8" ></td>
</tr>
</table>
<%
sql="select id,company,shortcorp from contact where pid="&classcode&" and cnflag=1 order by xuhao"
rs.Open sql,cn,1,1
do while not rs.EOF
ctitle=rs("shortcorp")
if trim(ctitle)="" then ctitle=rs("company")
if trim(keyno)=trim(rs("id")) then
ctitle="<font color=#DD4400>"&ctitle&"</font>"
end if
curl=myurl&"?keyno="&rs("id")
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="middle"> <table width="88%" height="18" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="137" align="center" valign="middle" background="images/about/nav_3.jpg"><table width="55%" height="18" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="middle" class="a01"><a href="<%=curl%>" class="a01"><%=ctitle%></a></td>
</tr>
</table></td>
<td align="left" valign="middle"> <img src="images/about/arrow_jt.gif" width="4" height="7"></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="8" ></td>
</tr>
</table>
<%
rs.MoveNext
loop
rs.Close
%>
</td>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="18" align="left" valign="top"><img src="images/contact/line_point.jpg" width="603" height="17"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center" valign="middle" class="font3"><%=keytitle%></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><table width="100%" height="4" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="4" bgcolor="#FFFFFF" ></td>
<td width="450" height="4" bgcolor="#d5d5d5" ></td>
<td width="20" height="4" bgcolor="#FFFFFF" ></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20"> </td>
</tr>
</table>
<table width="90%" align=center border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="font1"><font color="#333333">通信地址:<%=keyadd%><br>
电话:<%=keytel%> 传真:<%=keyfax%> email:<a class=a11 href="mailto:<%=toemail%>"><%=toemail%></a><br>
邮编:<%=keyzip%></font></span>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" align="center" valign="middle"> <table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
</table></td>
</tr>
</table>
<%if sendok=1 then%>
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height=100><font color=cc6633>留言成功,感谢您的使用!</font></td>
</tr>
<tr>
<td height=100></td>
</tr>
</table>
<%else%>
<style>
<!--
.input_both {border:1px solid #666666; font-family:"宋体"; font-size:12px; color:#333333;}
-->
</style>
<table width="96%" border="0" cellspacing="8" cellpadding="0" align="CENTER" valign=top style="line-height:120%">
<form name="form" method="post" action="<%=myurl%>?keyno=<%=keyno%>" onSubmit="return checkinput(form)" autocomplete = "off">
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">标题:</td>
<td width="555"> <input name="topic" type="text" class="input_both" size=40 maxlength=60>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">您的姓名:</td>
<td width="555"> <input name="myname" type="text" class="input_both" size=20 maxlength=60> <font size=1 color=red>*</font>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">Email:</td>
<td width="555"> <input name="email" type="text" class="input_both" size=40 maxlength=60> <font size=1 color=red>*</font>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">公司:</td>
<td width="555"> <input name="corpname" type="text" class="input_both" size=40 maxlength=60>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">地址:</td>
<td width="555"> <input name="address" type="text" class="input_both" size=40 maxlength=60>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">电话:</td>
<td width="555"> <input name="phone" type="text" class="input_both" size=40 maxlength=60>
</td>
</tr>
<tr>
<td width="104" align=right style="font-size:12px" class="font1_both">传真:</td>
<td width="555"> <input name="fax" type="text" class="input_both" size=30 maxlength=60>
</td>
</tr>
<tr>
<td align=right style="font-size:12px" class="font1_both" width="104">内容:</td>
<td width="555"><textarea name=content cols=50 rows=10 class="input_both" style="font-family:宋体"></textarea></td>
</tr>
<tr>
<td width="104" align=center valign=middle> <br>
</td>
<td width="555" valign=middle><input type="submit" value="提交" name=“B1”>
<a href="#" onClick="form.reset();form('topic').focus();return false;"><img src="images/an4.gif" width="69" height="19" border="0"></a></td>
</tr>
</form>
</table>
<%end if%>
</td>
<!--#include file="inc_righter.asp"-->
</tr>
</table>
<script language=Javascript>
var flag=true;
function checkinput(form)
{
if(form("content").value=="")
{alert("留言内容不能为空!");form("content").focus();flag=false;return flag;}else{flag=true;}
// if(form("topic").value=="")
// {alert("请输入留言标题!");form("topic").focus();flag=false;return flag;}else{flag=true;}
if(form("email").value=="")
{alert("请输入你的电子邮件地址!");form("email").focus();flag=false;return flag;}else{flag=true;}
if(form("email").value.search("@")==-1)
{alert("你的电子邮件地址填写有误,请检查输入!");form("email").focus();flag=false;return flag;}else{flag=true;}
if(form("myname").value=="")
{alert("请填入你的姓名!");form("myname").focus();flag=false;return flag;}else{flag=true;}
if (flag==true) {flag=checkchar(form("topic").value)}
if (flag==true) {flag=checkchar(form("email").value)}
if (flag==true) {flag=checkchar(form("myname").value)}
if (flag==true) {flag=checkchar(form("address").value)}
if (flag==true) {flag=checkchar(form("corpname").value)}
if (flag==true) {flag=checkchar(form("phone").value)}
if (flag==true) {flag=checkchar(form("fax").value)}
return flag;
}
function checkchar(str)
{
str=str.toLowerCase()
oldstr=str
str="2"+str
if (str.search("<"+"%")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("<scrip"+"t")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("'")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search('"')>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
return true;
}
function checkcharbody(str)
{
str=str.toLowerCase()
oldstr=str
str="2"+str
if (str.search("<"+"%")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
if (str.search("<scrip"+"t")>0)
{
window.alert("("+oldstr+")中有非法字符,请检查!");
return false;
}
return true;
}
</script>
<!--#include file="end.asp"--> --------------------编程问答-------------------- 这东东,你还是发ASP版比较合适。 --------------------编程问答-------------------- 这不是ASP?· --------------------编程问答-------------------- 这是ASP.NET, 后面有.NET就和ASP两码事了。:D, 不过你也可以为了省分。。。等人回答,或等版主移贴。 --------------------编程问答-------------------- 我在ASP 也发布了 谢谢你了 不过 有高手来也帮忙看下了···
补充:.NET技术 , ASP.NET