Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在经典asp中传递查询字符串参数时出错_Javascript_Asp.net_Asp Classic - Fatal编程技术网

Javascript 在经典asp中传递查询字符串参数时出错

Javascript 在经典asp中传递查询字符串参数时出错,javascript,asp.net,asp-classic,Javascript,Asp.net,Asp Classic,我在经典asp中工作,对语法不太熟悉 我的父页面上有这个JavaScript function redirect(ID) { document.frmMain.action = "manual.asp?ID=" + ID; alert('manual.asp?ID='+ID) document.frmMain.submit(); } 但当我在新的asp页面上捕获相同的ID时,它将变为空 <% SQLStr = "SELECT * FROM tblUsers WHERE ID=

我在经典asp中工作,对语法不太熟悉 我的父页面上有这个JavaScript

function redirect(ID)
{
 document.frmMain.action = "manual.asp?ID=" + ID;
 alert('manual.asp?ID='+ID)
 document.frmMain.submit();
}
但当我在新的asp页面上捕获相同的ID时,它将变为空

<%   
SQLStr = "SELECT * FROM tblUsers WHERE ID='" & Request.QueryString("ID") & "'"
set rst = DataConn.Execute(SQLStr)
Denied = 1
while not rst.eof
    Denied = 0
    rst.movenext
wend
rst.close
if Denied = 1 then  
%>


有人能帮我一下吗。

如果你用于重定向的表单是空的,你最好使用
window.location
来执行此任务

function redirect(id) {
    window.location.href = "manual.asp?id=" + id;
}  
如果表单不是空的,则必须为id添加一个字段,并用参数填充该字段

<form name="frmMain" action="manual.asp" method="get">
    <input type="text" name="paramter1" value="1" />
    <!-- hidden value for the id -->
    <input type="hidden" name="id" value="" />
</form>


function redirect(id) {
    var form = document.frmMain;
    form.id.value = id;
    form.submit();
}

函数重定向(id){
var form=document.frmMain;
form.id.value=id;
表单提交();
}

但是您仍然需要检查id参数是否存在任何可能破坏数据库的非法字符

谢谢Andreas:将检查您提供的解决方案