赞助连接

赞助连接

阅 读 文 章

关于ewebeditor编辑后html代码混乱的问题

[来源:网上转载 (CSDN转载) | 作者:网友(lauka) | 时间:2008-09-12 | 浏览:人次 ]

可能由于代 *** 过滤,使得编辑完后html代 *** 混乱,主要问题经常多一些逗号,属 *** 名称被分割   并且错位,使得代 *** 很乱,页面显示出代 *** 。表格错位等问题。  
  怀疑引起原因的两个方法:  
  //   清除WORD冗余格式并粘贴  
  function   cleanAndPaste(   html   )   {  
  //   Remove   all   SPAN   tags  
  html   =   html.replace(/<\/?SPAN[^>]*>/gi,   ""   );  
  //   Remove   Class   attributes  
  html   =   html.replace(/<(\w[^>]*)   class=([^   |>]*)([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   Style   attributes  
  html   =   html.replace(/<(\w[^>]*)   style="([^"]*)"([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   Lang   attributes  
  html   =   html.replace(/<(\w[^>]*)   lang=([^   |>]*)([^>]*)/gi,   "<$1$3")   ;  
  //   Remove   XML   elements   and   declarations  
  html   =   html.replace(/<\\?\?xml[^>]*>/gi,   "")   ;  
  //   Remove   Tags   with   XML   namespace   declarations:   <o:p></o:p>  
  html   =   html.replace(/<\/?\w+:[^>]*>/gi,   "")   ;  
  //   Replace   the   &nbsp;  
  html   =   html.replace(/&nbsp;/,   "   "   );  
  //   Transform   <P>   to   <DIV>  
  var   re   =   new   RegExp("(<P)([^>]*>.*?)(<\/P>)","gi")   ; //   Different   because   of   a   IE   5.0   error  
  html   =   html.replace(   re,   "<div$2</div>"   )   ;  
   
  insertHTML(   html   )   ;  
  }  
  //   替换特殊字符  
  function   HTMLEncode(text){  
  text   =   text.replace(/&/g,   "&amp;")   ;  
  text   =   text.replace(/"/g,   "&quot;")   ;  
  text   =   text.replace(/</g,   "&lt;")   ;  
  text   =   text.replace(/>/g,   "&gt;")   ;  
  text   =   text.replace(/'/g,   "&#146;")   ;  
  text   =   text.replace(/\   /g,"&nbsp;");  
  text   =   text.replace(/\n/g,"<br>");  
  text   =   text.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");  
  return   text;  
  }  
  不知道如何修改,请指点。
谁能帮我一下,挺急得
我用Ewebeditor时添加时没有问题,修改时文章会被分开,一部分显示在编辑框中,一部分在页面上,很困惑,帮楼主顶。
我也是修改的时候,而且从DreamWeaver里粘过来的“,”都变成全角的了
谁来帮忙~!!!
我解决不了这个问题,大家谁帮帮我,看来不是上面代 *** 的问题,谁能帮帮我
论坛热门帖子: [lch203] 写得蛮好的linux学习笔记(10-21)
[黑马制造] 学习java的30个目标(10-19)
[笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19)
[udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18)
[沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18)
TAG标签: 混乱 问题 代码 编辑 关于 // html text html.replace

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表

网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.