地球村欢迎您!
Tag: 在ASP中调用js里的编码函数预览模式: 图文 | 列表
经过几番周折,终于是写好了
< %set rs=server.createobject("adodb.recordset")
sql="select top 6 * from [News] where BigClassID=5 order by ID desc"  
rs.open sql,conn,1,1
if rs.eof then
response.write "No information!"
else
cnewstxt="< table cellspacing='0' cellpadding='0' width='100%' align='center'>< tbody>"
j=0
do while not rs.eof
if j>0 and j >= 6   then
exit do
end if
cnewstxt=cnewstxt&"< tr>< td align=left height=20>< img src='../images/news_icon.jpg' />  < a href='NewsShow"&rs("ID")&".html' title='"&rs("Title")&"'>"&cutstr(rs("Title"),15)&"< /a>< /td>< td align=right>2012-6-16< /td>< /tr>"% >
< %j=j+1
rs.movenext
loop
cnewstxt=cnewstxt&"< /tbody>< /table>"
end if
rs.close
set rs=nothing
% >    
< script language="javascript" type="text/javascript" runat="server">
function JSAngelEncode(sStr)
{
return escape(sStr);
}
< /script>
< %
Function aspEncode(sStr)
aspEncode= JSAngelEncode(sStr)
End Function
cnewstxt=aspEncode(cnewstxt)
response.Write cnewstxt
% >

查看更多...

Tags: &lt;转%3c escape unescape 在ASP中调用js里的编码函数

分类:学无止境 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 40