我在我的網站中使用ckeditor,它支持「分頁符」。樣本內容包含頁面破乳劑,如:如何通過「分頁符」分割一些html內容?
<h1>
Little Red Riding Hood</h1>
<p>
"<b>Little Red Riding Hood</b>" is a famous <a href="http://en.wikipedia.org/wiki/Fairy_tale" title="Fairy tale">fairy tale</a> about a young girl's encounter with a wolf. The story has been changed considerably in its history and subject to numerous modern adaptations and readings.</p>
<div style="page-break-after: always;">
<span style="display: none;"> </span></div>
<p>
The version most widely known today is based on the <a href="http://en.wikipedia.org/wiki/Brothers_Grimm" title="Brothers Grimm">Brothers Grimm</a> variant. It is about a girl called Little Red Riding Hood, after the red <a href="http://en.wikipedia.org/wiki/Hood_%28headgear%29" title="Hood (headgear)">hooded</a> <a href="http://en.wikipedia.org/wiki/Cape" title="Cape">cape</a> or <a href="http://en.wikipedia.org/wiki/Cloak" title="Cloak">cloak</a> she wears. The girl walks through the woods to deliver food to her sick grandmother.</p>
這種特殊的div是頁斷路器:
<div style="page-break-after: always;">
<span style="display: none;"> </span></div>
我想使用JavaScript的網頁斷路器的內容爲多頁拆分,告訴用戶將有多少頁面的內容,並且可以讓用戶預覽每一頁。
但如何檢查和分割它?是否有純JavaScript或「Extjs」的解決方案?
嗨。你不是試圖用split方法使用regexp嗎? – 2011-12-29 14:32:04
我剛剛用正則表達式來處理它 – Freewind 2011-12-29 14:41:57