$(function(){
Ajaxload("?Uid=1<%= Yan.GET_Dict(id, 8, TableName)%>")
$("#ThreeM a:first").addClass("addBg");
$(".pageP2 a").live("click",function(){var NewUrl=$(this).attr("href");if(jQuery.browser.msie){var IE=$.browser.version;if(IE=="7.0" || IE=="6.0"){NewUrl="?" NewUrl.split('?')[1]}};Ajaxload(NewUrl);return false;});/*return false阻止默认a标签跳转,改用ajax请求*/
$("#ThreeM a").click(function(){
if(!$(this).hasClass("addBg")){$("#ThreeM a").removeClass("addBg");$(this).addClass("addBg")}
var Url="?Uid=1" $(this).attr("id");
Ajaxload(Url);
})
})
function Ajaxload(parm)
{
$.ajax({
type: "GET",
url: "/stus/3th.aspx" parm,
cache: false,
beforeSend:function(){$("#Three").html("
load...
")},
success: function(msg){
$("#Three").html(msg);
},
error:function(){$("#Three").html("Load failure...")}
});
}
ajax提交获取过来的动态生成的a标签,用Live()方法绑定了click事件。第二次查询时会执行2次click事件,冒泡了。用one()方法的话,点击一次就失效了。