一只斗牛犬
12345678910111213141516171819// js也有地址传递, 来个例子吧 // 接收一个Object,没有返回值function test (obj2) { obj2.prop = 2; // 修改obj的属性 obj2.attr = 3; // 添加属性} // obj是一个对象var obj = { prop: 1 // obj的属性}; test(obj);// 没有返回值,但是obj被修改了alert(obj.prop); // 2alert(obj.attr); // 3 // 这种情况就是地址传递吧1234567891011121314151617181920for (var i = 0; i < 10; i++) { var obj = $("#a_id" + i); $.ajax({ url: "/url", type: "post", dataType: "json", data: ({}), success: success }); function success(json) { // 这里obj不会是"#a_id" + i // 而是for循环结束之后的obj,也就是#a_id9 alert(obj.text()); }} // for循环结束之后obj是#a_id9, 也就是最后一个alert(obj.attr('id') == 'a_id9'); // true