[导入]JavaScript在ASP里的应用!
网站做完了,好多错误,先试运行一段时间了!今天被这个文件搓折了一下!写上来分析一下:
<!--#include file="include/db_conn.asp"-->
<%
sql="select top 2 h_id,h_date,h_resume,h_address from t_house where h_web=yes order by h_sort,h_id"
set sr=Server.CreateObject("ADODB.recordset")
sr.open sql,conn,1,1
str="<table width=100% border=0 cellpadding=0 cellspacing=0><tr>"
do until sr.eof
sql_2="select top 1 w_pic from t_web_msg where w_msg_id="&sr("h_id")
set pic_set=conn.execute(sql_2)
pic_address=""
if not pic_set.eof then
pic_address=replace(pic_set("w_pic"),"//","/")
end if
if pic_address="" then
pic_address="/images/NoPic.gif"
end if
str=str&"<td width=50% ><table width=100% border=0><tr><td><a href='web_view_detail.asp?id="&sr("h_id")&"'>"
str=str&"<img src='"&pic_address&"' width='117' height='94' border='0' align='left'><b>"&sr("h_address")&"</b>["&month(sr("h_date"))&"-"&day(sr("h_date"))&"]<br>"&left(sr("h_resume"),200)&"......"
str=str&"</a></td></tr></table></td>"
sr.moveNext
loop
str=str&"</tr></table>"
str=replace(str,chr(10),"")
str=replace(str,chr(13),"")
response.Write("document.write("&chr(34)&str&chr(34)&");")
sr.close
set sr=nothing
CloseConn
%>
要注意一些替换,不然总有些JavaScript的错误!还有,注意浏览器对JavaScript的支持!今天没太多时间,就先写些,过些时候写个完整的文章上来!
文章来源:http://computer.mblogger.cn/wucountry/posts/24471.aspx
/\_/\
(=^o^=) Wu.Country@侠缘
(~)@(~) 一辈子,用心做一件事!
--------------------------------
学而不思则罔,思而不学则怠!
================================
posted on 2004-12-29 05:00 Wu.Country@侠缘 阅读(213) 评论(0) 编辑 收藏 举报