你的位置:首页 > Java教程

[Java教程]jquery功能实现总结


最近一直在做.net这方面的,也学习了jquery一些东西,其中实现了自动关闭页面,json解析字符串,拼接字符串,for循环,函数调用,等一些功能,自己也学习了,也希望可以帮助大家,大家看后给提提意见,有什么错误。

1  $(window).on('load', function () {

3      setInterval(function () {
4          window.close();
5      },20000)


7      Page = 1;

9      $.ajax({
10         type: "get",
11         url: "/Up_heat.ashx",
12         dataType: "json",
13         success: window.Sel_Name = function (TourNav) {
14             for (i = 1; i < TourNav.length; i++) {
15                 var Name = TourNav[i-1].Name;
16                 //Select(SelectNext());
17                 //alert(Name);
18                 Select(Name);
19             }
21             //i = 0;
22             //while (i < TourNav.length) {
23                 //var Name = TourNav[i].Name;
24                 //alert(Name);
$.ajax({ 10     type: "get", 11     url: "/Up_heat.ashx", 12     dataType: "json", 13     success: window.Sel_Name = function (TourNav) { 14       for (i = 1; i < TourNav.length; i++) { 15         var Name = TourNav[i-1].Name; 16         //Select(SelectNext()); 17         //alert(Name); 18         Select(Name); 19       } 21       //i = 0; 22       //while (i < TourNav.length) { 23         //var Name = TourNav[i].Name; 24         //alert(Name); 25         //Select(Name); 26         //i++; 27       //} 28     } 29   }) 

25                 //Select(Name);
26                 //i++;
27             //}
28         }
29     })
30     
31     function Select(Name) {
33         $.ajax({
34             type: "get",
35             data: {
36                 "text": Name,
37                 "divlen": Page
38             },
39             url: "/TravlNotett.ashx",
40             dataType: "json",
41             success: function (tour) {
42                 //for (a = 0; a < tour.data.books.length; a++) {
43
44                 //    SelectNext(Name);
45                 //    //alert(tour.data.books[a].title);
46                 //}
47                 //alert(tour.data.books[1].title);
48                 if (tour.data.books[0].title != " ") {
49                     SelectNext(Name);
50                 }
51                 else {
52                     alert("hello");
53                 }
54             }
55         })
56     }
57
58     function SelectNext(Name) {
59         $.ajax({
60             type: "get",
61             data: {
62                 "text": Name,
63                 "divlen": Page
64             },
65             url: "/TravlNotett.ashx",
66             dataType: "json",
67             success: function (tour) {
68                 if (tour.data.books[0].title != " ") {       
69                     Up_Heat(Name, Page);
70                     Page += 1;
71                     SelectNext(Name);
72                 }
73                 else {
74                     //alert("hello");
75                 }
76             }
77         })
78     }
79
80     function Up_Heat(Name, Page) {
81         $.ajax({
82             type: "post",
83             data: {
84                 "Name": Name,
85                 "Heat": Page
86             },
87             url: "/Up_heat_aa.ashx",
88             dataType: "json",
89             success: function (a) {
90                 //alert(a);
91             }
92         })
93     }
94 })