<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="用jquery怎么实现一个文章的自定义分段显示功能" id="card1">
<p> 游客</p><p>
标题:用jquery怎么实现一个文章的自定义分段显示功能<br/>
正文:<br/>
 <br/>这样的显示风格是不是很养眼啊？如果文章内容太多的话转换有点慢，希望大家能给我提出宝贵的意见。代码如下:<br/>&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt; <br/>&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt; <br/>&amp;lt;head&amp;gt; <br/>&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt; <br/>&amp;lt;title&amp;gt;文章分段&amp;lt;/title&amp;gt; <br/>&amp;lt;script src=&quot;http://code.jquery.com/jquery-1.8.3.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt; <br/>&amp;lt;script&amp;gt; <br/>var o = &quot;&quot;; <br/>$(function(){ <br/>o = $(&quot;.content&quot;).html(); <br/>}) <br/>function change(){ <br/>var lw = 0; <br/>var maxs = 0; <br/>var line = $(&quot;#line&quot;).val(); <br/>var h = o.split(&quot;&quot;); <br/>var webh = &quot;&quot;; <br/><br/>for(var i =0;i&amp;lt;h.length;i++){ <br/>webh+='&amp;lt;label&amp;gt;'+h[i]+'&amp;lt;/label&amp;gt;'; <br/>} <br/>$(&quot;.content&quot;).html(webh); <br/>$(&quot;.content label&quot;).each(function(){ <br/>if(maxs &amp;gt; $(this).position()['left']){ <br/>lw++; <br/>maxs =0; <br/>if(lw==line){ <br/>$(this).before('&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;'); <br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1102&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1102&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1102&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1102&amp;Page=3">[3]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1102&amp;Page=7">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=1102">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=1102">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>