如果想执行服务器端代码而又不转变当前页面,可以用如下代码解决:
这是default.asp文件
<%@ Language=VBScript %>
<%
response.expires=0
RsEnable=true
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function button1_onclick(i) {
var obj=RSExecute("remote.asp","riluo",i);
alert(obj.return_value);
return obj.return_value;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Button" id=button1 name=button1 LANGUAGE=javascript onclick="return button1_onclick(7)">
</BODY>
</HTML>
<%If RsEnable Then%>
<SCRIPT LANGUAGE=JavaScript SRC="<%=Application("U_Path")%>_ScriptLibrary/rs.htm"></SCRIPT>
<script language="JavaScript">RSEnableRemoteScripting();</script>
<%End If%>
这是remote.asp文件
<!--#include file="_ScriptLibrary/rs.asp"-->
<%RSDISPATCH%>
<SCRIPT LANGUAGE=javascript RUNAT=Server>
var public_description=new ms();
function ms()
{
this.riluo=Function('i',"return riluo(i);");
}
</script>
<%
function riluo(i)
riluo=i+1
end function
%>
ASP远程调用的演示代码.
2012-05-24 09:53:26
阅读 4528 次
评论 0 条
发表评论