value2是一个文本框的ID,在里面写值传给变量rule1,并通过rule1的值来检索数据库字段id(自增变量,int型),通过Button控件调用该函数,但是浏览器中在该处显示如下错误:
<script type="text/javascript">
function displaymessage()
{
alert("222222")
var rule1 =document.getElementById('value2').value
alert(rule1)
if (rule1!="")
{ alert(rule1)
An error occurred on the server when processing the URL. Please contact the system administrator. <p/> If you are the system administrator please click <a href="http://go.microsoft.com/fwlink/?LinkID=82731">here</a> to find out more about this error.下面是代码:
<script type="text/javascript">
function displaymessage()
{
var rule1 =document.getElementById('value2').value
if (rule1!="")
{
           <%
   Dim Recordset3
   Set Recordset3 = Server.CreateObject("ADODB.Recordset")
   Recordset3.ActiveConnection ="dsn=test;uid=sa;"
   dim strsqlForShow
   strsqlForShow = "SELECT *  FROM dbo.test WHERE id =rule1"
   Recordset3.Source = strsqlForShow
   Recordset3.CursorType = 0
   Recordset3.CursorLocation = 2
   Recordset3.LockType = 1
  Recordset3.Open()
 %>
document.getElementById('value1').value=<%=(Recordset3.Fields.Item("fenshu").Value)%>
document.getElementById('shuru').value=<%=(Recordset3.Fields.Item("title").Value)%>
         }
}
</script>

解决方案 »

  1.   

    ASP写的 没有报错 在浏览器里面点Button控件没任何反应,alert不弹出,查看源代码出现
    if (rule1!="")
    { alert(rule1)
    An error occurred on the server when processing the URL. Please contact the system administrator. <p/> If you are the system administrator please click <a href="http://go.microsoft.com/fwlink/?LinkID=82731">here</a> to find out more about this error