Long story pagination Code

Source: Internet
Author: User

When warehousing the HR when the content page character, and then warehousing And then add the tags to the top and the tail of the storage article
<!--$pages $-->
For example:
Dim str;
str = Trim (Request ("Textareaid"));
str = "<!--$pages $-->" +str+ "<!--$pages $-->"
str = Replace (str, str, "And then warehousing, and everything is done.

Code:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Untitled Document </title>
<style type= "Text/css" >
<!--
div{font-size:14px;}
-->
</style>

<body>
<textarea name= "cols=" "rows=" "id=" Conpage "style=" Display:none; " >
<!--$pages $-->
How are you doing
<!--$pages $-->
I'm So
<!--$pages $-->
He's fine.
<!--$pages $-->
Everything's fine.
<!--$pages $-->
</textarea>
<script language= "JavaScript" >
var Zhenze =/[^0-9]/;//Create regular, indicating non-numeric strings
var thispage = document.getElementById ("Conpage"). value;//Get Content
var page_amount,x;
Page_amount = Thispage.split (' <!--$pages $--> '). length;
Number of $pages$ in page_amount--;//content
var asarray = new Array ();//Array
var v=0;
for (Var t=0;t<page_amount;t++) {
Asarray[t] = Thispage.indexof ("<!--$pages $-->", v);//Record the location of each $pages$
V=ASARRAY[T];
v++;
};
page_amount--;
for (Var s=0;s<page_amount;s++) {
Here is a paragraph that writes all the contents
document.write (' <div id= ' pg ' + (s+1) + ' style= ' block ' > ');
document.write (thispage.substring (asarray[s],asarray[s+1));
document.write (' </div> ');
alert (s+1);
};


var obj,objt
var s_a_d = 1;//The number of page IDs currently displayed, default to page 1th, and when ShowPage is set, this variable is used to record the last page numbers displayed,
function Hidpage (Hidt {//This function is used to hide the number of pages
Obj=eval (' document.getElementById (' pg ' +hidt+ ') ');
Obj.style.display = "None";
                        };
       
Functions ShowPage (SOW) {//This function is used to display the number of pages
obj = eval (" document.getElementById (' pg ' +sow+ ")");
Objt = eval ("document.getElementById (' PG" + (S_A_D) + ")")//This sentence is the last page number displayed
Objt.style.display = "None"; Hides the last page number displayed
Obj.style.display = "block";//Displays the page number that the current user needs to display
S_a_d = sow;
document.getElementById ("Pageamo"). Value = sow; 
Alert ("currently displayed first" +s_a_d+ "page");
                       };        

var TTS;
function goto () {//page steering function, where the user enters the page number in the text box and turns to
TTS = document.getElementById ("Inputpage"). Value;
if (!tts.match (zhenze) = = "") {
Alert ("Error, you entered non-numeric type character");
Return
};
if (Tts>page_amount | | TTS < 1) {
Alert ("No this page")//illegal input all test complete
}else{
ShowPage (TTS);//Legal execution steering
};
};


document.write (' <div> ');
document.write (' You are now in the <input type= "button" id= "Pageamo" value= "" +s_a_d+ "" style= "FONT-SIZE:12PX;HEIGHT:18PX; Background-color: #FFFFFF; Color:red;font-weight:bold;border: #FFFFFF 0px solid; " > page ');//Mark current page number
document.write (' Total ' +page_amount+ ' page ');/Total Pages
for (Var k=0;k<page_amount;k++) {
document.write (' <a href= "javascript:showpage (' + (k+1) + ') ' style= ' Text-decoration:none;" > ');
document.write ("[" + (K+1) + "]");
document.write (' </a> ');
Hidpage (k+1);//Hide All pages
};//for Write page Number: 1 2 3 4 5 ....
ShowPage (1);//First Display first page content
document.write (' Go to <input type= "text" id= "Inputpage" style= "width:20px;font-size:12px;height:18px;" Value= "" > page ');//Turn to form
document.write (' <input type= "button" value= "Go" onclick= "goto ()" style= "height:20px;" > ');
document.write (' </div> ');
</script>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.