ajax+php+mysql無刷新分頁代碼
ajax+php教程+mysql教程無刷新分頁代碼
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
2 <html>
3 <head>
4 <title>投票結果</title>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
7 <script type="text/網頁特效">
8
9 function getxmlhttpobject()
10 {
11 var xmlhttp=null;
12 try
13 {
14 // firefox, opera 8.0+, safari
15 xmlhttp=new xmlhttprequest();
16 }
17 catch (e)
18 {
19 // internet explorer
20 try
21 {
22 xmlhttp=new activexobject("msxml2.xmlhttp");
23 }
24 catch (e)
25 {
26 xmlhttp=new activexobject("microsoft.xmlhttp");
27 }
28 }
29 return xmlhttp;
30 }
31 function checkajax(){
32 xmlhttp=getxmlhttpobject()
33
34 if (xmlhttp==null)
35 {
36 alert ("您的浏覽器不支持ajax!");
37 return ;
38 }else
39 {
40 return xmlhttp;
41 }
42 }
43 function preshow(){
44 ajaxobj = checkajax();
45 var url = "page.php?page=1";
46 ajaxobj.onreadystatechange=statechanged;
47 ajaxobj.open("get",url,true);
48 ajaxobj.send(null);
49 }
50 function showhint1(str)
51 {
52 ajaxobj = checkajax();
53 document.getelementbyid("msg").innerhtml="正在讀取數據……";
54
55 var url = str;
56 ajaxobj.onreadystatechange=statechanged;
57 ajaxobj.open("get",url,true);
58 ajaxobj.send(null);
59
60 }
1 2