js解决文章内容分页

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title></head>
<body>
<form name="all"><DIV id=article></DIV><xml id=xmlArticle>
<Article>
<Info><Content><![CDATA[经典论坛dddddddddddddddd
ddddddddddddddddddddddddddddddddddddddddddddddd
ssssssssssssss<br/>ssssssssssssssssssssssssssssssssssssssssssssssssss&raquo;
前台制作与脚本专栏 经典论坛 &raquo; 前台制作与
“八月十五月儿圆,中秋月饼香又甜”,一年一度的中秋佳节虽未到来,但月饼宣传促销活动早已拉开序幕,各大超市、商场的货架也已摆上了各式各样的月饼。

然而,有消费者反映,尽管包装很精美,但打开月饼盒盖,却有一股刺鼻的气味扑面而来。其实,这种刺鼻气味的产生与月饼盒粘接过程中所使用的胶水有很大的关系。

据了解,自国家出台《月饼强制性国家标准》等相关政策,严禁奢华包装之后,今年的月饼盒基本上以纸盒为主。

那么,月饼纸盒究竟使用哪些胶水呢?

1、白乳胶

聚醋酸乙烯乳液,简称PVAc,俗称白乳胶、乳白胶,是由醋酸乙烯经乳液聚合后加入邻苯二甲酸二丁酯增塑剂而得。

白乳胶的外观是乳白色粘稠状流体,无毒,安全,不燃,粘接性强、稳定性好、价格价廉,因此,广泛应用于粘接纸制品,如月饼纸盒。

2、水性裱糊胶

水性裱糊胶,是水性乳液胶水,乳白色均匀液体,流动性好,粘接力强,无毒无味,有松香本体味道。

由于水性裱糊胶具有无毒、无刺激性气味,不燃烧,无腐蚀性,使用方便等特点,因此,广泛适用于灰板纸、礼品纸盒、高档酒盒的裱坑粘合。

不过,与白乳胶相比,水性裱糊胶的价格相对贵些,一般情况下,比较高档的月饼盒才会使用。

3、水性纸塑胶

水性纸塑胶,是环保型水溶性胶粘剂,不含有害毒质,不危害臭氧层,应用于过塑纸与膜的粘合。

由于胶膜拉伸强度大,内增塑性好,韧柔性强,胶质光滑细腻,易于清洗,具有阻燃防火功能,因此,那些过塑的月饼纸盒会用到水性纸塑胶。

4、热熔胶

热熔胶,是一种无溶剂型热塑性固体胶粘剂,具有粘结快、效率高、无毒害、不污染等特点,属于绿色环保的胶粘剂,很有发展前途。

不过,热熔胶的种类很多,月饼盒的粘合应该选用包装用热熔胶。

除此之外,月饼纸盒的粘合还可以使用其它类型胶水,如黄胶、万能胶、502胶等。当然,在月饼纸盒的粘合过程中,选用环保型胶水,比较安全、无危害。

因此,为健康着想,消费者在选购月饼时,应注意观察其包装及包装盒气味的轻重。

脚本专栏 经典论坛 &raquo; 前台制作与脚本专栏 经典论坛 &raquo;
前台制作与脚本专栏 经典论坛 &raquo; 前台制作与脚本专栏 经典论坛 &raquo; 前台制作与脚本专栏 经典论坛 &raquo;
前台制作与脚本专栏 经典论坛 &raquo; 前台制作与脚本专栏 经典论坛 &raquo; 前台制作与脚本专栏 经典论坛 &raquo;
前台制作与脚本专栏 ]]></Content></Info>
</Article>
</xml></form>
<SCRIPT language=Javascript>
//每页显示字数
PageSize =1250;
//分页模式
flag = 1; //1:根据字数自动分页 2:根据[NextPage]分页
//默认页
startpage = 1;
//导航显示样式 0:常规 1:直接 2:下拉
TopShowStyle = 1;
DownShowStyle = 0;
var currentSet, CutFlag, TotalByte, PageCount, key, tempText, tempPage;
key = "";
currentSet = 0;
var Text = xmlArticle.selectSingleNode("//Content").text;
TotalByte = Text.length;
if (flag == 1) {
PageCount = Math.round(TotalByte / PageSize);
if (parseFloat("0." + TotalByte % PageSize) > 0) {
if (parseFloat("0." + TotalByte % PageSize) < 0.5) {
PageCount = PageCount + 1;
}
}
var PageNum = new Array(PageCount + 1);
var PageTitle = new Array(PageCount + 1);
PageNum[0] = 0;
PageTitle[0] = "";

var sDrv1, sDrv2, sDrv3, sDrv4, sFlag;
var sDrvL, sTemL;
var sTem1, sTem2, k;
sFlag = 0;

for (j = 1; j < PageCount + 1; j++) {
PageNum[j] = PageNum[j - 1] + PageSize;
PageTitle[j] = "";
//alert(j);
sDrv1 = "<br>";
sDrv2 = "<BR>";
sDrv3 = "<Br>";
sDrv4 = "<bR>";
sDrvL = sDrv1.length;
for (k = PageNum[j]; k <= TotalByte; k++) {
sTem1 = Text.substring(PageNum[j] - sDrvL, k);
sTemL = sTem1.length;
sTem2 = sTem1.substring(sTemL - sDrvL, sTemL)
if (sTem2 == sDrv1 || sTem2 == sDrv2 || sTem2 == sDrv3 || sTem2 == sDrv4) {
sFlag = sFlag + 1;
PageNum[j] = k;
break;
}
}
if (PageNum[j] > TotalByte) {
break;
}
}
if (j < PageCount) {
PageNum.length = j;
PageCount = j
}
if (PageCount > 1 && sFlag > 1 && PageCount < sFlag) {
PageCount = sFlag + 1;
}
}
else {
//手动分页
var j, sFlag, PageCount, sText;
var sTitleFlag;
var PageNum = new Array();
var PageTitle = new Array();
PageSize = 0;
j = 1;
PageNum[0] = -10;
PageTitle[0] = "";
sFlag = 0;
sText = Text;
do {
sText = Text.substring(PageNum[j - 1] + 10, TotalByte);
sFlag = sText.indexOf("[NextPage");
if (sText.substring(sFlag + 9, sFlag + 10) == "=") {
sTitleFlag = sText.indexOf("]", sFlag);
PageTitle[j] = sText.substring(sFlag + 10, sTitleFlag);
}
else {
PageTitle[j] = "";
}
if (sFlag > 0) {
PageNum[j] = sFlag + PageNum[j - 1] + 10;
}
else {
PageNum[j] = TotalByte;
}
j += 1;
}
while (PageNum[j - 1] < TotalByte);
PageCount = j - 1;
}
function text_pagination(Page) {
var Output, Byte;
Output = "";
if (Page == null) { Page = 1; }
//头部功能导航条
Output = Output + "<div style=text-align:right;>";
//页码显示方式一
//第x页:分页标题
if (Page == 0 || PageCount == 0) {
Output = Output + "当前是:<font color=#FFFF00>全文显示</font>";
}
else {
if (TotalByte > PageSize) { Byte = PageNum[Page] - PageNum[Page - 1] } else { Byte = TotalByte };
Output = Output + "第 <font color=#FFFF00>" + Page + "</font> 页";
if (PageTitle[Page] != "") {
Output = Output + ":<font color=800000>" + PageTitle[Page] + "</font>";
}
}
Output = Output + "</div>";
//显示正文
if (Page == 0) {
//不分页
tempText = Text;
}
else {
//分页
if (flag == 1)
//自动分页
{
tempText = Text.substring(PageNum[Page - 1], PageNum[Page]);
}
else {
//手动分页
if (PageTitle[Page - 1].length == 0) {
tempText = Text.substring(PageNum[Page - 1] + 10, PageNum[Page]);
}
else {
tempText = Text.substring(PageNum[Page - 1] + 11 + PageTitle[Page - 1].length, PageNum[Page]);
}
}
}

//布置内容
// Output=Output+"<div align=center>";
// Output=Output+Article_PageNav(TopShowStyle,Page);
// Output=Output+"</div>";

Output = Output + "<div id=world>";
Output = Output + tempText;
Output = Output + "</div>";
Output = Output + "<br>";
Output = Output + "<div align=center>";
Output = Output + Article_PageNav(DownShowStyle, Page);
Output = Output + "</div>";

article.innerHTML = Output;
if (Page > 1)
{ document.location.href = '#top'; }
}
function Article_PageNav(ShowStyle, Page) {
//分页码显示函数
//参数为调用样式,0=简单样式,1=标准样式
var temp = "";
if (ShowStyle == 0)
//简单样式
{
tempPage = Page;
if (TotalByte > PageSize) {
if (Page - 4 <= 1) {
temp = temp + "<font face=webdings color=#999999>9</font>";
if (Page <= 1) { temp = temp + "<font face=webdings color=#999999>7</font>"; } else { temp = temp + "<a href=javascript:text_pagination(" + (Page - 1) + ")><font face=webdings>7</font></a>"; }
if (PageCount > 10) {
for (i = 1; i < 8; i++) {
if (i == Page) {
temp = temp + "<font color=red>" + i + "</font> ";
} else {
temp = temp + "<a href=javascript:text_pagination(" + i + ") >" + i + "</a>" + " ";
}
}
temp = temp + " ...";
}
else {
for (i = 1; i < PageCount + 1; i++) {
if (i == Page) {
temp = temp + "<font color=red>" + i + "</font> ";
}
else {
temp = temp + "<a href=javascript:text_pagination(" + i + ") >" + i + "</a>" + " ";
}
}
}
if (Page == PageCount) { temp = temp + "<font face=webdings color=#999999>8</font>"; } else { temp = temp + "<a href=javascript:text_pagination(" + (Page + 1) + ")><font face=webdings>8</font></a>"; }
if (PageCount < 10) { temp = temp + "<font face=webdings color=#999999>:</font>"; } else { temp = temp + "<a href=javascript:text_pagination(" + PageCount + ")><font face=webdings>:</font></a>"; }
}
else if (Page + 4 <= PageCount) {
temp = temp + "<a href=javascript:text_pagination(1)><font face=webdings>9</font></a>";
temp = temp + "<a href=javascript:text_pagination(" + (Page - 1) + ")><font face=webdings>7</font></a>";
if (PageCount > 10) {
temp = temp + "..";
for (i = Page - 4; i < Page + 4; i++) {
if (i == Page) {
temp = temp + "<font color=red>" + i + "</font> ";
}
else {
temp = temp + "<a href=javascript:text_pagination(" + i + ") >" + i + "</a>" + " ";
}
}
temp = temp + " ..";
}
else {
for (i = 1; i < PageCount + 1; i++) {
if (i == Page) {
temp = temp + "<font color=red>" + i + "</font> ";
}
else {
temp = temp + "<a href=javascript:text_pagination(" + i + ") >" + i + "</a>" + " ";
}
}
}

if (Page == PageCount) { temp = temp + "<font face=webdings color=#999999>8</font>"; } else { temp = temp + "<a href=javascript:text_pagination(" + (Page + 1) + ")><font face=webdings>8</font></a>"; }
temp = temp + "<a href=javascript:text_pagination(" + PageCount + ")><font face=webdings>:</font></a>";
}
else {
temp = temp + "<a href=javascript:text_pagination(1)><font face=webdings>9</font></a>";
temp = temp + "<a href=javascript:text_pagination(" + (Page - 1) + ")><font face=webdings>7</font></a>";
temp = temp + ".."
for (i = Page - 2; i < PageCount + 1; i++) {
if (i == Page) {
temp = temp + "<font color=red>" + i + "</font> ";
}
else {
temp = temp + "<a href=javascript:text_pagination(" + i + ") >" + i + "</a>" + " ";
}
}
if (Page == PageCount) { temp = temp + "<font face=webdings color=#999999>8</font>"; } else { temp = temp + "<a href=javascript:text_pagination(" + (Page + 1) + ")><font face=webdings>8</font></a>"; }
temp = temp + "<font face=webdings color=#999999>:</font>";
}
}
else {
// temp=temp+"<font color=red>1</font> ";
}
// temp=temp+" <a href=javascript:text_pagination(0)>显示全部</a>"
}
else if (ShowStyle == 1)
//标准样式
{
if (TotalByte > PageSize) { if (Page != 0) { if (Page != 1) { temp = temp + "<a href='#top' οnclick=javascript:text_pagination(" + (Page - 1) + ")><font color=3366cc>[上一页]</font></a>&nbsp;&nbsp;"; } } }
for (i = 1; i < PageCount + 1; i++) {
if (Page == i) {
temp = temp + "<font color=800000>[" + i + "]</font>&nbsp;&nbsp;";
}
else {
temp = temp + "<a href='#top' οnclick=javascript:text_pagination(" + i + ")><font color=3366cc>[" + i + "]</font></a>&nbsp;&nbsp;";
}
}
temp = temp + "<a name='foot'></a>";
if (TotalByte > PageSize) { if (Page != 0) { if (Page != PageCount) { temp = temp + "<a href='#top' οnclick=javascript:text_pagination(" + (Page + 1) + ")><font color=3366cc>[下一页]</font></a>"; } } }
temp = temp + " <a href=javascript:text_pagination(0)><font color=3366cc>显示全部</font></a>"
}
else if (ShowStyle == 2)
//下拉菜单样式
{
temp = temp + '<select οnchange="text_pagination(this.value)">'
for (i = 1; i < PageCount + 1; i++) {
if (Page == i) {
temp = temp + "<option value='" + i + "' selected style='color:red'>第 " + i + " 页"

}
else {
temp = temp + "<option value='" + i + "'>第 " + i + " 页";
}
if (PageTitle[i].length != 0) {
temp = temp + ':' + PageTitle[i];
}
temp = temp + "</option>";
}
temp = temp + "</select>";
}
return (temp);
}
//默认页
text_pagination(startpage);
</SCRIPT>
</body></html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值