JAVAScript向ASP传递参数并获取返回值?
文件1:CallTitle.asp<%Classid =Request("Classid").....If Classid <> "0" ThenSql = "Select * From clistInfo Where cListInfo-Lock And ClistInfo_class = "&classidElseSql = "Select * From clistInfo Where cListInfo-Lock"End IfIf Reco <>"0" ThenSql = Sql + " And cListInfo_Recommendation"End IfIf Picdisplay <> "0" ThenSql =Sql + " And ClistInfo_pic"End IfSql = Sql + " Order by ClistInfo_PublishTime Desc"Set rs_list = server.createobject("adodb.recordset")rs_list.open sql,conn,1,1f=0Response.Write sqldo while not Rs_list.eof and f<iResponse.Writers_list.movenextf=f+1looprs_list.closeset rsnews=NothingEnd Function%>上面的没有写完其中一行 Response.Write sql我用于测试返回值另外一个文件Test.asp内容<Script Src="CallTitle.asp?Classid=1"><Script>怎么没有返回值,什么提示都没有?~
参考答案:<Script Src="CallTitle.asp?Classid=1"><Script>
少加一个结束符</Script>
JS调用的话 被调用的文件输出文本的语法应该是JS语法 而不是ASP的Response.Write
1.asp
<Script Src="2.asp?Classid=1"></Script>
2.asp
<%
classid=request("classid")
%>
document.write("<%=classid%>")
JS用document.write来输出文本