html中用js调用ASP文件,实现静态页面动态显示

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&""");"
%>


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: asp javascript
相关日志:
评论: 10 | 引用: 0 | 查看次数: -
回复回复clong[2010-04-17 11:43 PM | del]
好象不能运行!
回复回复caihua[2007-09-24 10:46 PM | del]
谢谢,不错!
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.