废话不多说了,直接上代码算了。
页面代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<TITLE>****问卷调查</TITLE>
<LINK rel=stylesheet type=text/css
href="xxeddc/default.css">
<STYLE type=text/css>
#logo {
width:100px;
height:auto;
float:left;
margin:30px 0px 0px 9px;
}
#site {
BACKGROUND-IMAGE: url(xxeddc/top_bg.jpg);
MARGIN: 7px auto 0px;
WIDTH: 960px;
HEIGHT: 160px
}
#site .title {
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src="xxeddc/filter.png");
MARGIN: 30px 9px 0px 0px;
WIDTH: 716px;
BACKGROUND: none transparent scroll repeat 0% 0%;
FLOAT: right;
HEIGHT: 90px
}
.STYLE1 {font-size: 14px}
#submitbutton{
background:url(xxeddc/btn_bg.gif) no-repeat;
width:85px;
height:36px;
border:0px;
cursor:pointer;
color:#FFFFFF;
font-size:14px;
}
.successmsg{
PADDING-BOTTOM: 0px; LINE-HEIGHT: 32px; MARGIN: 0px; PADDING-LEFT: 0px; WIDTH: 936px; PADDING-RIGHT: 0px; FONT-FAMILY: "verdana"; BACKGROUND: #f1f6f8; HEIGHT: 32px; COLOR: #0067af; FONT-SIZE: 18px; BORDER: #c2e3f1 1px solid; FONT-WEIGHT: bold; PADDING-TOP: 0px
}
</STYLE>
<script language="JavaScript" type="text/javascript">
//定时跳转函数
function countDown(secs,surl){
//alert(surl);
tiao.innerText=secs;//<span>中显示的内容值
if(--secs>0){
setTimeout("countDown("+secs+",'"+surl+"')",1000);//设定超时时间
}
else{
location.href=surl;//跳转页面
}
}
//求单选按纽的值,适用单选项及多选项。未选返回false;有选择项,返回选项值。
function getRadio(oRadio){
var oRadioLength= oRadio.length;
var oRadioValue = false;
//alert( oRadioLength);
//alert("oRadioLength:["+oRadioLength+"]");
if (oRadioLength== undefined){
if (oRadio.checked){
oRadioValue = oRadio.value;
}
}else{
for (i=0;i<oRadioLength;i++){
//alert("oRadio["+i+"]:"+oRadio[i].checked+"/"+oRadio[i].value);
if (oRadio[i].checked){
oRadioValue = oRadio[i].value;
break;
}
}
}
return oRadioValue;
}
function VF_form1(){ //v2.0
<!--start_of_saved_settings-->
<!--type,textarea,name,m_neirong,required,true,errMsg,请填写邮件内容-->
<!--type,text,name,m_zhuzi,required,true,errMsg,请填写邮件的主题-->
<!--type,text,name,m_user,required,true,isEmail,errMsg,对不起.你未填写邮箱地址或邮箱地址不正确-->
<!--type,text,name,xinlinianling,required,true,errMsg,请填写您的心理年龄-->
<!--end_of_saved_settings-->
var theForm = document.form1;
var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
var errMsg = "";
var setfocus = "";
/* if (theForm['xinlinianling'].value == ""){
errMsg = "请填写您的心理年龄";
setfocus = "['xinlinianling']";
}
if (theForm['xingming'].value == ""){
errMsg = "请填写您的姓名";
setfocus = "['xingming']";
}
if (theForm['dianhua'].value == ""){
errMsg = "请填写您的电话";
setfocus = "['dianhua']";
}
if (!emailRE.test(theForm['email'].value)){
errMsg = "对不起.你未填写邮箱地址或邮箱地址不正确";
setfocus = "['email']";
} */
if (getRadio(theForm.RadioGroup1) == false){
errMsg = "请选择您的实际年龄";
setfocus = "['RadioGroup1_0']";
}
if (getRadio(theForm.RadioGroup2) == false){
errMsg = "请选择您是否有IPAD";
setfocus = "['RadioGroup2_0']";
}
if (getRadio(theForm.RadioGroup3) == false){
errMsg = "请选择您是否愿意参加";
setfocus = "['RadioGroup3_0']";
}
if (errMsg != ""){
alert(errMsg);
try{
eval("theForm" + setfocus + ".focus()");
}
catch(exception) {
alert(exception);
}
return false;
}
else {
theForm.submit();
}
}
function TJK_noWayBack(){
history.go(1);
}
//TJK_noWayBack();
//-->
</script>
</head>
<BODY>
<DIV align=center>
<DIV id=site>
<DIV id="logo">
<img src="xxeddc/logoshuxiang.png" width="90" height="90">
</DIV>
<DIV class=title>
<DIV class=sitename><A href="http://www.****.com">****问卷调查</A></DIV>
<DIV class=sitehtmlurl><SPAN
class=sitehtmlurl>http://www.****.com</SPAN></DIV>
</DIV>
</DIV>
<DIV id=content>
<DIV id=infonav>
<DIV class=haveText>欢迎您访问****!我们的网站还在建设中。我们正在开展关于<span lang="EN-US" xml:lang="EN-US">ipad</span>的学习坊,如果您有兴趣,欢迎填写一份简单的问卷:</DIV>
</DIV>
<DIV class=details>
<LINK rel=stylesheet type=text/css href="xxeddc/Box.css">
<!--[if IE 6]>
<link rel="stylesheet" href="xxeddc/Slider.ie6.css" type="text/css" media="screen">
<![endif]-->
<STYLE>
#overlay {
BACKGROUND-IMAGE: url(xxeddc/overlay.png)
}
* HTML #overlay {
BACKGROUND-IMAGE: url(xxeddc/blank.gif); FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="xxeddc/overlay.png", sizingMethod="scale"); BACKGROUND-COLOR: transparent
}
</STYLE>
<LINK rel=stylesheet type=text/css href="xxeddc/Notification.css">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff>
<form action="mail.asp" method="post" name="form1" onSubmit="VF_form1();return false;">
<TBODY>
<TR>
<TD><TABLE id=question_1 class=pertable cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<tr>
<td width="245" height="30" class="question"><span lang="EN-US" xml:lang="EN-US">1.</span>请问您的实际年龄是?</td>
</tr>
<tr>
<td height="30" class="answer" onactivate="this.style.backgroundColor='#f0f0f0'" ondeactivate="this.style.backgroundColor='#ffffff'" >
<label>
<input name="RadioGroup1" type="radio" id="RadioGroup1_0" value="45岁以下" />
45岁以下</label>
<br />
<label>
<input type="radio" name="RadioGroup1" value="45-54岁" id="RadioGroup1_1" />
45-54岁</label>
<br />
<label>
<input type="radio" name="RadioGroup1" value="55-64岁" id="RadioGroup1_2" />
55-64岁</label>
<br />
<label>
<input type="radio" name="RadioGroup1" value="65-74岁" id="RadioGroup1_3" />
65-74岁</label>
<br />
<label>
<input type="radio" name="RadioGroup1" value="75岁以上" id="RadioGroup1_4" />
75岁以上</label>
<br />
</td>
</tr>
<tr>
<td height="30" class="question"><span lang="EN-US" xml:lang="EN-US">2.</span>请问您觉得自己的心理年龄是?<span lang="EN-US" xml:lang="EN-US"></span></td>
</tr>
<tr>
<td height="30" onactivate="this.style.backgroundColor='#f0f0f0'" ondeactivate="this.style.backgroundColor='#ffffff'"><label>
<input name="xinlinianling" type="text" class="answer" id="xinlinianling" />
</label></td>
</tr>
<tr>
<td height="30" class="question"><span lang="EN-US" xml:lang="EN-US">3.</span>请问您有<span lang="EN-US" xml:lang="EN-US">ipad</span>吗?<span lang="EN-US" xml:lang="EN-US"></span></td>
</tr>
<tr>
<td height="30" class="answer" onactivate="this.style.backgroundColor='#f0f0f0'" ondeactivate="this.style.backgroundColor='#ffffff'">
<label>
<input type="radio" name="RadioGroup2" value="有" id="RadioGroup2_0" />
有</label>
<br />
<label>
<input type="radio" name="RadioGroup2" value="没有" id="RadioGroup2_1" />
没有</label>
<br />
<label>
<input type="radio" name="RadioGroup2" value="没听说过" id="RadioGroup2_2" />
没听说过</label>
<br />
</td>
</tr>
<tr>
<td height="30" class="question"><span lang="EN-US" xml:lang="EN-US">4.</span>在香港等地已经有专门针对退休人士的<span lang="EN-US" xml:lang="EN-US">ipad</span>学习坊,如果深圳有类似的活动,您愿意参加吗?<span lang="EN-US" xml:lang="EN-US"></span></td>
</tr>
<tr>
<td height="30" class="answer" onactivate="this.style.backgroundColor='#f0f0f0'" ondeactivate="this.style.backgroundColor='#ffffff'">
<label>
<input type="radio" name="RadioGroup3" value="愿意" id="RadioGroup3_0" />
愿意</span></label>
<br />
<label>
<input type="radio" name="RadioGroup3" value="不愿意" id="RadioGroup3_1" />
不愿意</span></label>
<br />
</p></td>
</tr>
<tr>
<td height="30" class="question"> 如果您乐意参与,可以报名试听!<span lang="EN-US" xml:lang="EN-US"></span></td>
</tr>
<tr>
<td height="30" class="answer" onactivate="this.style.backgroundColor='#f0f0f0'" ondeactivate="this.style.backgroundColor='#ffffff'">您的姓名?
<label>
<input name="xingming" type="text" class="answer" id="xingming" />
<br>
</label>
<label>您的电话?
<input name="dianhua" type="text" class="answer" id="dianhua" />
<br>
</label>
您的邮件?
<label>
<input name="email" type="text" class="answer" id="email" />
</label>
</td>
</tr>
<tr>
<td height="30" align="center"><input type="hidden" name="MM_insert" value="form1" />
<input name="Submit" type="submit" id="submitbutton" value="提交问卷" /></td>
</tr>
</table></TD>
</TR>
</form>
</TBODY>
</TABLE>
</DIV>
</DIV>
</DIV>
</BODY>
</HTML>
程序部分如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<TITLE>****问卷调查</TITLE>
<LINK rel=stylesheet type=text/css href="xxeddc/default.css">
<LINK rel=stylesheet type=text/css href="xxeddc/Box.css">
<LINK rel=stylesheet type=text/css href="xxeddc/Notification.css">
<!--[if IE 6]>
<link rel="stylesheet" href="xxeddc/Slider.ie6.css" type="text/css" media="screen">
<![endif]-->
<STYLE>
#overlay {
BACKGROUND-IMAGE: url(xxeddc/overlay.png)
}
* HTML #overlay {
BACKGROUND-IMAGE: url(xxeddc/blank.gif);
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="xxeddc/overlay.png", sizingMethod="scale");
BACKGROUND-COLOR: transparent
}
#logo {
width:100px;
height:auto;
float:left;
margin:30px 0px 0px 9px;
}
#site {
BACKGROUND-IMAGE: url(xxeddc/top_bg.jpg);
MARGIN: 7px auto 0px;
WIDTH: 960px;
HEIGHT: 160px
}
#site .title {
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src="xxeddc/filter.png");
MARGIN: 30px 9px 0px 0px;
WIDTH: 716px;
BACKGROUND: none transparent scroll repeat 0% 0%;
FLOAT: right;
HEIGHT: 90px
}
.STYLE1 {
font-size: 14px
}
.successmsg {
PADDING-BOTTOM: 0px;
LINE-HEIGHT: 32px;
MARGIN: 0px;
PADDING-LEFT: 0px;
WIDTH: 936px;
PADDING-RIGHT: 0px;
FONT-FAMILY: "verdana";
BACKGROUND: #f1f6f8;
HEIGHT: 32px;
COLOR: #0067af;
FONT-SIZE: 18px;
BORDER: #c2e3f1 1px solid;
FONT-WEIGHT: bold;
PADDING-TOP: 0px
}
</STYLE>
<script language="JavaScript" type="text/javascript">
//定时跳转函数
function countDown(secs,surl){
//alert(surl);
tiao.innerText=secs;//<span>中显示的内容值
if(--secs>0){
setTimeout("countDown("+secs+",'"+surl+"')",1000);//设定超时时间
}
else{
location.href=surl;//跳转页面
}
}
</script>
</head>
<DIV align=center>
<DIV id=site>
<DIV id="logo"> <img src="xxeddc/logoshuxiang.png" width="90" height="90"> </DIV>
<DIV class=title>
<DIV class=sitename><A
href="http://www.****.com">****问卷调查</A></DIV>
<DIV class=sitehtmlurl><SPAN
class=sitehtmlurl>http://www.****.com</SPAN></DIV>
</DIV>
</DIV>
<DIV id=content>
<DIV id=infonav>
<DIV class=haveText >欢迎您访问****!我们的网站还在建设中。我们正在开展关于<span lang="EN-US" xml:lang="EN-US">ipad</span>的学习坊,如果您有兴趣,欢迎填写一份简单的问卷:</DIV>
</DIV>
<DIV class=details>
<%
If (CStr(Request("MM_insert")) = "form1") Then
info_shijinianling=Trim(Request.Form("RadioGroup1"))
info_xinlinianling=Trim(Request.Form("xinlinianling"))
info_ipad=Trim(Request.Form("RadioGroup2"))
info_shifoucanjia=Trim(Request.Form("RadioGroup3"))
info_xingming=Trim(Request.Form("xingming"))
info_dianhua=Trim(Request.Form("dianhua"))
info_email=Trim(Request.Form("email"))
info="实际年龄:" & info_shijinianling & VBCrLf & "心理年龄:" & info_xinlinianling & VBCrLf & "是否有ipad:" & info_ipad & VBCrLf & "是否愿意参加:" & info_shifoucanjia & VBCrLf & "姓名:" & info_xingming & VBCrLf & "电话:" & info_dianhua & VBCrLf & "邮件:" & info_email
%>
<!--发送代码-->
<%
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort=2
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic=1
Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.****.com.cn" '改成可用的外部邮件服务器域名
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "sender@****.com.cn" '以上服务器的用户名
.Item(cdoSendPassword) = "***@***" '密码
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = "info@****.com.cn" '改成接收者的邮件地址
'.To = "bill@****.com.cn" '改成接收者的邮件地址
.From = "sender@****.com.cn" '改成发送人的邮件地址
.Subject = "****问卷调查信息" '标题
.TextBody = info '正文
'.AddAttachment "C:\Scripts\Output.txt"'邮件附件
'.Send
End With
on error resume next
objMessage.send
if err.number<>0 then
response.write("出错啦!:"&err.description)
response.End()
end if
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>
<!--发送代码-->
<span class="successmsg">提交成功!谢谢您的参与! <span id="tiao">5</span>秒后自动跳转到<a href="index.html">****主页</a></span>
<script language=javascript>countDown(5,'index.html');</script>
<!--提交成功!谢谢您的参与!<a href="index.html">返回****主页</a> -->
<%
'else
%>
<%
end if
%>