#12003/12/5 12:13:49
Microsoft VBScript 编译器错误 错误 '800a03f6'
各位大虾。我是菜鸟。请教问题?我用DW做了个提交留言的页面。结果测试出现了
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e10'
[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1。
/feibook/insert.asp,行115
我把我的代码放在下面。请各位大虾指点谢谢
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/feibook.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) = "form1") Then
MM_editConnection = MM_feibook_STRING
MM_editTable = "main"
MM_editRedirectUrl = "index.asp"
MM_fieldsStr = "Name|value|Email|value|Homepage|value|QQ|value|MSN|value|Content|value|ICON|value"
MM_columnsStr = "Name|',none,''|Email|',none,''|Homepage|',none,''|QQ|none,none,NULL|MSN|',none,''|Content|',none,''|ICON|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tablevalues
Dim MM_dbvalues
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tablevalues = ""
MM_dbvalues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tablevalues = MM_tablevalues & ","
MM_dbvalues = MM_dbvalues & ","
End If
MM_tablevalues = MM_tablevalues & MM_columns(MM_i)
MM_dbvalues = MM_dbvalues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tablevalues & ") values (" & MM_dbvalues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set 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 <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim Ri
Dim Ri_numRows
Set Ri = Server.CreateObject("ADODB.Recordset")
Ri.ActiveConnection = MM_feibook_STRING
Ri.Source = "SELECT * FROM main"
Ri.CursorType = 0
Ri.CursorLocation = 2
Ri.LockType = 1
Ri.Open()
Ri_numRows = 0
%>
<!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>
<style type="text/css">
<!--
-->
</style>
<link href="file:///D|/guestbook/css.css" rel="stylesheet" type="text/css"><br>
<script language="javascript">
<!--
window.onload=function (){//页面加载完毕时执行
var obj=document.form1;
obj.onmouseover=function(){//表单项(文本框、多行文本框)在鼠标移上时变换背景颜色的函数(函数①)
if(event.srcElement.tagName=="INPUT"||event.srcElement.tagName=="TEXTAREA")//判断当对象标签为input或textarea时执行
event.srcElement.style.backgroundColor="#EEEEEE";//对象背景颜色变换#EEEEEE
}
obj.onmouseout=function(){//表单项(文本框、多行文本框)在鼠标移出时变换背景颜色的函数(函数②)
if(event.srcElement.tagName=="INPUT"||event.srcElement.tagName=="TEXTAREA")//判断当对象标签为input或textarea时执行
event.srcElement.style.backgroundColor="#DDDDDD";//对象背景颜色变换#DDDDDD
}
icon.onclick=function(){//单击头像图片时把图片名中的数字传递到隐藏域ICON的函数(函数③)
obj.ICON.value=event.srcElement.src.match(/(0[1-6])(?=\.jpg)/g)[0];//将所点击的图片路径地址中的01-06赋值给隐藏域ICON
}
obj.onsubmit=function(){//验证表单的函数(函数④)
var error=""
if(obj.Name.value=="")error+="●昵称项不能为空\n\n";
if(obj.Email.value=="")error+="●信箱项不能为空\n\n";
else if(!/^\w(\w*\.*)*@(\w+\.)+\w{2,4}$/.test(obj.Email.value))error+="●信箱格式不正确\n\n";
if(obj.Homepage.value!=obj.Homepage.defaultvalue&&!/^(http:\/\/[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+)$/.test(obj.Homepage.value))error+="●网址格式不正确\n\n"
if(obj.QQ.value!=""&&!/^[1-9]\d{4,8}$/.test(obj.QQ.value))error+="●QQ号码只能是5位到9位的数字\n\n"
if(obj.Content.value=="")error+="●留言内容不能为空\n\n";
else if(obj.Content.value.length>1000){error+="●留言字符长度超出1000";obj.Content.value=obj.Content.value.substring(0,1000)}
if(error!=""){alert("错误提示:\n\n"+error);return false;}
else return true;
}
}
//-->
</script>
</head>
<body>
<table width="649" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" class="thin">
<tr>
<td width="661" height="35" background="file:///D|/guestbook/images/topbg.gif"><div align="center">我的留言版</div></td>
</tr>
<tr>
<td height="20" background="file:///D|/guestbook/images/bmbg.gif"><div align="right"><a href="file:///D|/guestbook/insert.asp">『留言』</a><a href="file:///D|/guestbook/index.asp">『查看』</a><a href="file:///D|/guestbook/login.asp">『管理』</a> </div></td>
</tr>
<tr>
<td height="95" valign="top"><form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
<table width="98%" border="0" align="center">
<tr>
<td width="7%">昵称:</td>
<td width="42%"><input name="Name" type="text" id="Name" maxlength="8"></td>
<td width="7%">邮箱:</td>
<td width="44%"><input name="Email" type="text" id="Email" value="@" maxlength="20"></td>
</tr>
<tr>
<td>主页:</td>
<td><input name="Homepage" type="text" id="Homepage" value="http://" maxlength="30"></td>
<td>QQ;</td>
<td><input name="QQ" type="text" id="QQ" maxlength="9"></td>
</tr>
<tr>
<td>MSN:</td>
<td><input name="MSN" type="text" id="MSN" maxlength="30"></td>
<td> </td>
<td> </td>
</tr>
<tr valign="top">
<td colspan="4" nowrap id="icon" title="单击图片选择头像"><div align="center"><img src="face/icon/1.gif" width="64" height="64" onclick="ICON.value='face/icon/1.gif'"> <img src="face/icon/2.gif" width="64" height="64" onclick="ICON.value='face/icon/2.gif'"><img src="face/icon/3.gif" onclick="ICON.value='face/icon/3.gif'" width="64" height="64"><img src="face/icon/4.gif" width="64" height="64"><img src="face/icon/5.gif" width="64" height="64"><img src="face/icon/6.gif" width="64" height="64"><img src="face/icon/7.gif" width="64" height="64"><img src="face/icon/8.gif" width="64" height="64"><img src="face/icon/9.gif" width="64" height="64"><img src="face/icon/10.gif" width="64" height="64"><br>
<img src="face/icon/11.gif" width="64" height="64"><img src="face/icon/12.gif" width="64" height="64"><img src="face/icon/13.gif" width="64" height="64"><img src="face/icon/14.gif" width="64" height="64"><img src="face/icon/15.gif" width="64" height="64"><img src="face/icon/16.gif" width="64" height="64"><img src="face/icon/17.gif" width="64" height="64"><img src="face/icon/18.gif" width="64" height="64"><img src="face/icon/19.gif" width="64" height="64"><img src="face/icon/20.gif" width="64" height="64"></div></td>
</tr>
<tr>
<td colspan="4"><div align="center">留言</div></td>
</tr>
<tr>
<td colspan="4"><div align="center">
<textarea name="Content" cols="50" rows="5" id="Content"></textarea>
</div></td>
</tr>
<tr>
<td> </td>
<td><div align="center">
<input type="submit" name="Submit" value="提交留言">
</div></td>
<td colspan="2"> <input type="reset" name="Submit2" value="重新输入"> </td>
</tr>
</table>
<div align="center"></div>
<input name="ICON" type="hidden" id="ICON" value="onclick">
<input type="hidden" name="MM_insert" value="form1">
</form>
</td>
</tr>
<tr>
<td height="20" background="file:///D|/guestbook/images/bbg.gif"><div align="center">版权所有®阿飞在线</div></td>
</tr>
</table>
<form name="form2" method="post" action="">
</form>
</body>
</html>
<%
Ri.Close()
Set Ri = Nothing
%>
还有在留言时候选择头像怎么做呀。谢谢。是不是问的太多了。因为我是菜鸟呀。