社区
JavaScript
帖子详情
document.write("<%=server.htmlencode(HTMLstr)%>");
gyx999
2002-11-16 10:24:26
在javascript中想显示htmlstr。
document.write("<%=server.htmlencode(HTMLstr)%>");就是不行!
...全文
37
5
打赏
收藏
document.write("<%=server.htmlencode(HTMLstr)%>");
在javascript中想显示htmlstr。 document.write("");就是不行!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Lostinet
2002-11-17
打赏
举报
回复
...
你要进行字符串编码才行哦。.
如果服务器端的脚本是JScript 那么:
<%
function EncodeJScriptCode(str)
{
str=str+"";
str=str.replace(/\x5c/g,"\\\\");
str=str.replace(/\x2f/g,"\\/");
str=str.replace(/\x3cS/g,"\\u003cS");
str=str.replace(/\x3cs/g,"\\u003cs");
str=str.replace(/\x22/g,"\\\"");
str=str.replace(/\x27/g,"\\\'");
str=str.replace(/\t/g,"\\t");
str=str.replace(/\n/g,"\\\n");
str=str.replace(/\r/g,"\\r");
return str;
}
%>
<script>
document.write("<%=EncodeJScriptCode(HTMLstr)%>");
</script>
gyx999
2002-11-17
打赏
举报
回复
HTMLstr是用javascript生成的一段代码,我想打印出来看看。
希偌
2002-11-16
打赏
举报
回复
楼上的,js没有C#那么麻烦,何需那么麻烦
document.write("<%=server.htmlencode(HTMLstr)%>");
我用这句就能够正常显示,关键你的HTMLstr是什么?还有你其他的代码又是什么
jery_lee
2002-11-16
打赏
举报
回复
呵呵这个是BUG!
试一试
response.write "docu"&"ment.wr"&"ite('"&"server.htmlencode(HTMLstr)&");"
wzz24
2002-11-16
打赏
举报
回复
服务器端用<%%>,而document.write用于客户端,不一致呀!
Deformity ASP/ASPX Webshell、Webshell Hidden Learning
0. Active
Server
Page(ASP) 1. ASP.NET 2. ASP WEBSHELL变形方式 3. ASPX WEBSHELL变形方式 4. webshell中常见的编码转换隐藏方式 0. Active
Server
Page(ASP) ASP是动态服务器页面(Active
Server
Page)...
php 广告加载类
php 广告加载类,支持异步与同步加载。需要使用Jquery ... <?php /** 广告加载管理类 * Date: 2013-08-04 * Author: fdipzone * Ver: 1.0 * * Func: * public load 加载广告集合 * public setConfig 广告配
实现html和word的相互转换(带图片)
目前从html转换的word为doc格式,而图片处理支持的是docx格式,所以需要手动把doc另存为docx,然后才可以进行图片替换。 一.添加maven依赖 主要使用了以下和poi相关的依赖,为了便于获取html的图片元素,还使用了...
基于itext的html转pdf的代码实现,亲测可用
">打印时间:{{ dateTime | date:'yyyy-MM-dd HH:mm:ss'}}</div><div style="float: right;">打印人:{{ settings.user.realname }}</div> </div> <table class="purchaseTable"> <tr> <td class="header">申请...
python web自动化测试框架搭建(功能&接口)——通用模块
<style> body{counter-reset:num;} li{list-style: none;text-indent:10px;} li:after{content: counter(num);counter-increment:num;} pre { white-space: pre-wrap; word-wrap: break-word; display:...
JavaScript
87,955
社区成员
224,621
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章