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


资料来源:学网(http://www.xue5.com/),原文地址:http://www.xue5.com/itedu/200802/102963.html

你可能感兴趣的:(asp)