<转%3c,escape,unescape的使用和在ASP中调用js里的编码函数
作者:admin 日期:2012-06-24
经过几番周折,终于是写好了
< %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
% >
< %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
% >
[本日志由 admin 于 2012-07-02 06:54 PM 编辑]
上一篇: 网站制作中CSS设置H1不换行下一篇: 温州市浩莱斯机械有限公司,排水板包边机,无纺布制袋机
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: <转%3c escape unescape 在ASP中调用js里的编码函数
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论