一个类新闻网站,有大量的表格,内容是从别的网站copy 过来的,可是html代码经常copy不全,少 </td>  or <table> 等,请问如何解决?

解决方案 »

  1.   

    哈哈,俺也被这个问题郁闷了很长时间。
    试试放到<object></object>之间。
      

  2.   

    不行,看一看下面的代码,真不知道,这编辑怎么  copy 的,他们都是从 word 里直接 copy<object>
    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="95%"><tbody><tr><td height="10%"><p align="center">生产电器材料招标通告 </p></td></tr><tr><td align="left" height="5%" width="550"><hr></td></tr><tr><td height="70%" valign="top"><p class="MsoNormal" style="margin: 0cm 0cm 0pt 24pt; text-indent: -24pt;"><b><span style="font-family: 宋体;" lang="EN-US"><font size="3">一、</font><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b><b><font size="3"><span style="font-family: 宋体;">投标要求</span><span lang="EN-US"><o:p></o:p></span></font></b></p>
    <td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; background: white none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 128pt; height: 15pt;" valign="bottom" width="171">
    <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center;" align="center"><span style="font-size: 9pt; font-family: Arial;" lang="EN-US">50.32 24VAC<o:p></o:p></span></p></td>
    <td style="border-style: none solid solid none; border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 48pt; height: 15p</object>
      

  3.   

    深表同情~~~又缺"又缺>的输出前把最后的半截html标签用正则去掉试试str=str.replace(/<[^>]*?$/gi,"")实在不行,最绝的办法就是把内容中的格式标签全用正则去掉,剩下的半截标签<或>替换成&gt;或&lt;。这样,内容区域就毫无格式挤到一起了,半截html标签也会被看到,但是页面肯定不会乱。
      

  4.   

    同情,
    首先用EditPlus,DM 等工具,替换"<" 为 回车+"<" 然后再替换 回车+"</" 为 "</" 
    这样,可能看着要舒服一些,用带颜色的,来匹配单引号和双引号匹配,应该也很快的。如果楼主有很多这样的东西要处理,那就写个程序吧。
    看看<XXXX 后面是否有对应的 </XXXX 几个肯定没有匹配的不必处理(<br><hr>等)
      

  5.   

    太复杂了,大家遇到这种问题一般是如何做的? 一定也有好多是从 word  copy 到网上的录入问题,从编程上,或者从录上来说.我曾想让编辑 用图片的方式录入,可是效果也不是很好.
      

  6.   

    把页面用dreamwear编辑,如果有不匹配的,会有提示的
      

  7.   

    嗯,我又把代码优化了一下,好一些,让编辑用 dreamwear 也不太现实
      

  8.   

    要我说干脆滤掉html,从新编辑
      

  9.   

    要根本解决该问题你可以自己用javascript开发一个在线编辑器,或想办法'偷'人家一个,通过这东西发表,这样他们在发表时就会发现错在那了,从而即时改正.