| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 719 人关注过本帖
标题:菜鸟求助!!(本人今天第一次做网页)
只看楼主 加入收藏
cakecc
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-11-19
收藏
 问题点数:0 回复次数:8 
菜鸟求助!!(本人今天第一次做网页)

按照教程书籍中制作用户注册系统的步骤做好 分别有3张页面:reg.asp regsuccess.asp regfail.asp.按书上说在"提交"按钮上插入记录(表单form1)和检查新用户名 再设置检查表单事件.数据库是ACCESS,并建立好表,在DW中也成功添加数据库"usersys".目的是当输入完用户信息后 按提交按钮 如果用户名不重复,则把数据插入到数据库"usersys"中的表info中,并转到页面regsuccess.asp 如果用户名重复则转到regfail.asp页面 按重置按钮则清空所填信息.
我现在语到的问题是按"提交"按钮后出现

无法显示网页

您要访问的网页有问题,无法显示。

测试URL:http://localhost/reg.asp 如果单独打开另外2个页面则能正常显示.我的是XP SP2系统 IIS5.0 DW MX2004 为什么不能成功插入数据到表中并跳转页面? 帮帮我

搜索更多相关主题的帖子: 网页 数据库 asp 
2005-11-19 23:37
cakecc
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-11-19
收藏
得分:0 
http://localhost/reg.asp http://localhost/regsuccess.asp http://localhost/regfail.asp?
用户名: 注册成功 注册失败 返回
密码:
确认密码:
性别:
邮箱:
问题:
答案:
2005-11-19 23:41
cakecc
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-11-19
收藏
得分:0 
用户名: 按提交后:http://localhost/reg.asp?

无法显示网页

您要访问的网页有问题,无法显示。

请尝试以下操作:

  • 打开 localhost 主页,然后查找指向您感兴趣信息的链接。
  • 单击刷新按钮,或以后再试。
  • 单击搜索,寻找 Internet 上的信息。
  • 也可查看相关站点列表


HTTP 500 - 内部服务器错误
Internet Explorer

密码:
确认密码:
性别:
邮箱:
问题:
答案:
2005-11-19 23:42
风过无影
Rank: 1
等 级:新手上路
威 望:1
帖 子:346
专家分:0
注 册:2005-5-14
收藏
得分:0 
与数据库的联接有没有问题

成都IT人才网 www.
2005-11-20 15:44
oyyunlong
Rank: 1
等 级:新手上路
帖 子:251
专家分:0
注 册:2004-11-17
收藏
得分:0 

麻烦你把你的后台程序贴出来看下,才能知道啊


欲望在心中沸腾§野性在这刻爆发※束缚不住的灵魂δ弥漫与天地! 
2005-11-20 16:44
cakecc
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-11-19
收藏
得分:0 

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/usersys.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;

// query string to execute
var MM_editQuery = "";
%>
<%
// *** Redirect if username exists
var MM_flag="MM_insert";
if (String(Request(MM_flag)) != "undefined") {
var MM_dupKeyRedirect="regfail.asp";
var MM_rsKeyConnection=MM_usersys_STRING;
var MM_dupKeyUsernameValue = String(Request.Form("username"));
var MM_dupKeySQL = "SELECT username FROM info WHERE username='" + MM_dupKeyUsernameValue + "'"
var MM_adodbRecordset = "ADODB.Recordset";
var MM_rsKey = Server.CreateObject(MM_adodbRecordset);
MM_rsKey.ActiveConnection = MM_rsKeyConnection;
MM_rsKey.Source = MM_dupKeySQL;
MM_rsKey.CursorType=0;
MM_rsKey.CursorLocation=2;
MM_rsKey.LockType=3;
MM_rsKey.Open();
if (!MM_rsKey.EOF || !MM_rsKey.BOF) {
// the username was found - can not add the requested username
var MM_qsChar = "?";
if (MM_dupKeyRedirect.indexOf("?") >= 0) MM_qsChar = "&";
MM_dupKeyRedirect = MM_dupKeyRedirect + MM_qsChar + "requsername=" + MM_dupKeyUsernameValue;
Response.Redirect(MM_dupKeyRedirect);
}
MM_rsKey.Close();
}
%>
<%
// *** Insert Record: set variables

if (String(Request("MM_insert")) == "form1") {

var MM_editConnection = MM_usersys_STRING;
var MM_editTable = "info";
var MM_editRedirectUrl = "regsuccess.asp";
var MM_fieldsStr = "username|value|password|value|sex|value|email|value|question|value|answer|value";
var MM_columnsStr = "username|',none,''|password|',none,''|sex|',none,''|email|',none,''|question|',none,''|answer|',none,''";

// create the MM_fields and MM_columns arrays
var MM_fields = MM_fieldsStr.split("|");
var MM_columns = MM_columnsStr.split("|");

// set the form values
for (var i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = String(Request.Form(MM_fields[i]));
}

// append the query string to the redirect URL
if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
}
}
%>
<%
// *** Insert Record: construct a sql insert statement and execute it

if (String(Request("MM_insert")) != "undefined") {

// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(",");
var delim = (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined") {
formVal = emptyVal;
} else {
if (altVal != "") {
formVal = altVal;
} else if (delim == "'") { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''") + "'";
} else {
formVal = delim + formVal + delim;
}
}
MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
MM_dbValues += ((i != 0) ? "," : "") + formVal;
}
MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";

if (!MM_abortEdit) {
// execute the insert
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();

if (MM_editRedirectUrl) {
Response.Redirect(MM_editRedirectUrl);
}
}

}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body>
<form name="form1" method="POST" action="<%=MM_editAction%>">
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>用户名:
<input name="username" type="text" id="username" maxlength="20"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>密码:
<input name="password" type="password" id="password" maxlength="20"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>确认密码:
<input name="password1" type="password" id="password1" maxlength="20"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>性别:
<input type="radio" name="sex" value="男">

<input type="radio" name="sex" value="女">
女</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>邮箱:
<input name="email" type="text" id="email" maxlength="20"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>问题:
<input name="question" type="text" id="question" maxlength="50"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>答案:
<input name="answer" type="text" id="answer" maxlength="50"></td>
<td>&nbsp;</td>
</tr>
</table>
<input name="Submit" type="submit" onClick="MM_validateForm('username','','R','email','','NisEmail','question','','R','answer','','R','password','','R','password1','','R');return document.MM_returnValue" value="提交">
<input type="reset" name="Submit2" value="重置">
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>

2005-11-20 17:13
dreame
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:521
专家分:0
注 册:2005-10-23
收藏
得分:0 
又是DW生成的!

有时候真的想放弃寂寞的等待,但她是那么的可爱!I love u forever!
2005-11-21 20:05
daming225
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-11-27
收藏
得分:0 
晕了

我要学习了!
2005-11-28 16:36
teenever
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-11-30
收藏
得分:0 
我只想说,第一天做网页就做表单了,今非昔比一~
2005-11-30 17:54
快速回复:菜鸟求助!!(本人今天第一次做网页)
数据加载中...
 
   



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

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