- 理解同步和异步的概念
- 理解回调函数的概念
1
var i = 0;
2
3
var timer = setInterval(function(){
4
$(".color").hide();
5
$(".color").eq(i).show();
6
i++;
7
if (i == $(".color").length) i = 0;
8
},1000);
9
10
var t = 0;
11
$.ajax({
12
url:"http://localhost:8080/Review/test",
13
success:function(rs){
14
t = 1;
15
console.log(rs);
16
console.log("t in success = " + t);
17
}
18
})
19
20
console.log("t outside = " + t);
使用原生的JS进行DOM操作相对较少,在JS的框架中,jQuery和ExtJS(Apple,自成体系)