Heim > Web-Frontend > HTML-Tutorial > Teilen Sie ein Beispiel für Spezialeffektcode, der statisches Webseiten-Paging simuliert

Teilen Sie ein Beispiel für Spezialeffektcode, der statisches Webseiten-Paging simuliert

伊谢尔伦
Freigeben: 2017-06-16 10:47:05
Original
1807 Leute haben es durchsucht

Spezialeffektcode zur Simulation von statischem Paging.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> New Document </TITLE>

<META NAME="Generator" CONTENT="EditPlus">

<META NAME="Author" CONTENT="">

<META NAME="Keywords" CONTENT="">

<META NAME="Description" CONTENT="">

<style>

* {

font-size:10.2pt;

font-family:tahoma;

line-height:150%;

}

.divContent

{

border:1px solid red;

background-color:#FFD2D3;

width:500px;

word-break:break-all;

margin:10px 0px 10px;

padding:10px;

}

</style>

</HEAD>

<BODY>

header

<div id="divPagenation"></div>

<div id="divContent"></div>

footer

<SCRIPT LANGUAGE="JavaScript">

<!--

s="<p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p>";

function DHTMLpagenation(content) { with (this)

{

// client static html file pagenation

this.content=content;

this.contentLength=content.length;

this.pageSizeCount;

this.perpageLength=100; //default perpage byte length.

this.currentPage=1;

//this.regularExp=/.+[\?\&]{1}page=(\d+)/;

this.regularExp=/\d+/;

this.divDisplayContent;

this.contentStyle=null;

this.strDisplayContent="";

this.divDisplayPagenation;

this.strDisplayPagenation="";

arguments.length==2?perpageLength=arguments[1]:&#39;&#39;;

try {

divExecuteTime=document.createElement("DIV");

document.body.appendChild(divExecuteTime);

}

catch(e)

{

}

if(document.getElementById("divContent"))

{

divDisplayContent=document.getElementById("divContent");

}

else

{

try

{

divDisplayContent=document.createElement("DIV");

divDisplayContent.id="divContent";

document.body.appendChild(divDisplayContent);

}

catch(e)

{

return false;

}

}

if(document.getElementById("divPagenation"))

{

divDisplayPagenation=document.getElementById("divPagenation");

}

else

{

try

{

divDisplayPagenation=document.createElement("DIV");

divDisplayPagenation.id="divPagenation";

document.body.appendChild(divDisplayPagenation);

}

catch(e)

{

return false;

}

}

DHTMLpagenation.initialize();

return this;

}};

DHTMLpagenation.initialize=function() { with (this)

{

divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";

if(contentLength<=perpageLength)

{

strDisplayContent=content;

divDisplayContent.innerHTML=strDisplayContent;

return null;

}

pageSizeCount=Math.ceil((contentLength/perpageLength));

DHTMLpagenation.goto(currentPage);

DHTMLpagenation.displayContent();

}};

DHTMLpagenation.displayPage=function() { with (this)

{

strDisplayPagenation="分页:";

if(currentPage&&currentPage!=1)

strDisplayPagenation+=&#39;<a href="javascript:void(0)" onclick="DHTMLpagenation.previous()">上一页</a>  &#39;;

else

strDisplayPagenation+="上一页  ";

for(var i=1;i<=pageSizeCount;i++)

{

if(i!=currentPage)

strDisplayPagenation+=&#39;<a href="javascript:void(0)" onclick="DHTMLpagenation.goto(&#39;+i+&#39;);">&#39;+i+&#39;</a>  &#39;;

else

strDisplayPagenation+=i+"  ";

}

if(currentPage&&currentPage!=pageSizeCount)

strDisplayPagenation+=&#39;<a href="javascript:void(0)" onclick="DHTMLpagenation.next()">下一页</a>  &#39;;

else

strDisplayPagenation+="下一页  ";

strDisplayPagenation+="共 " + pageSizeCount + " 页,每页" + perpageLength + " 字符,调整字符数:<input type=&#39;text&#39; value=&#39;"+perpageLength+"&#39; id=&#39;ctlPerpageLength&#39;><input type=&#39;button&#39; value=&#39;确定&#39; onclick=&#39;DHTMLpagenation.change(document.getElementById(\"ctlPerpageLength\").value);&#39;>";

divDisplayPagenation.innerHTML=strDisplayPagenation;

}};

DHTMLpagenation.previous=function() { with(this)

{

DHTMLpagenation.goto(currentPage-1);

}};

DHTMLpagenation.next=function() { with(this)

{

DHTMLpagenation.goto(currentPage+1);

}};

DHTMLpagenation.goto=function(iCurrentPage) { with (this)

{

startime=new Date();

if(regularExp.test(iCurrentPage))

{

currentPage=iCurrentPage;

strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);

}

else

{

alert("page parameter error!");

}

DHTMLpagenation.displayPage();

DHTMLpagenation.displayContent();

}};

DHTMLpagenation.displayContent=function() { with (this)

{

divDisplayContent.innerHTML=strDisplayContent;

}};

DHTMLpagenation.change=function(iPerpageLength) { with(this)

{

if(regularExp.test(iPerpageLength))

{

DHTMLpagenation.perpageLength=iPerpageLength;

DHTMLpagenation.currentPage=1;

DHTMLpagenation.initialize();

}

else

{

alert("请输入数字");

}

}};

// method

// DHTMLpagenation(strContent,perpageLength)

DHTMLpagenation(s,100);

//-->

</SCRIPT>

</BODY>

</HTML>

Nach dem Login kopieren

Das obige ist der detaillierte Inhalt vonTeilen Sie ein Beispiel für Spezialeffektcode, der statisches Webseiten-Paging simuliert. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage