html中用js調用ASP檔案,實現靜態頁面動態顯示,比如HMTL文章的動態新聞評論等
---簡單版[調用代碼,把他放哪兒,就在哪兒顯示]--------
<script language="javascript" src="asdf.asp"></script>
-----asdf.asp檔案----------
<%
Response.Write "document.write(""hello"");" '根據自己需要處理相關東西!
%>
-------------------------------------------------------------------------------
---複雜版[調用代碼,把他放哪兒,就在哪兒顯示]--------
<script language="javascript" src="asdf.asp?cname=spell"></script>
-----asdf.asp檔案----------
<!--#include file="conn.asp"-->
<%
cname=request.QueryString("cname")
turl=request.ServerVariables("URL")
sql="s elect gongsi from company where cname='"+cname+"'"
rs.open sql,connstr,1,1
do while not rs.eof
Response.Write "document.write("" <table width=100% border=0><tr bgcolor=#ECE9D8> "");"
Response.Write "document.write("" <td width=100>" & Rs("gongsi") & "</td> "");"
Response.Write "document.write("" </tr><tr height=3></tr></table> "");"
'Response.Write(gsname)
rs.movenext
loop
Response.Write "document.write("""&turl&""");"
%>
資料來源:學網(http://www.xue5.com/),原文地址:http://www.xue5.com/itedu/200802/102963.html