52,797
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript" src="JavaScript/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript">
//ajax调用显示内容方法
function display(id,obj)
{
$.ajax({
type:"post",
url:"MemberShowInfo.ashx",
data:"id="+escape(id),
dataType:"json",
success: function(data, textStatus){
$("#"+obj.id+"").click(function(){$(this).showMessage(data.result);});
},
error: function(XMLHttpRequest,textStatus,errorThrown){
//请求出错处理
alert("服务器发生错误,错误编号:"+XMLHttpRequest.responseText);
}
});
}
jQuery.fn.extend({
showMessage:function(html){
if($.trim(html)!=""){
//wbx是弹出层的Css样式名,用于自定义Div层的外观,弹出位置为Dom元素的下方,透明度0.8,尺寸自适应html内容的尺寸
var warndiv=$("<div></div>").addClass("wbx").html(html).css({position:"absolute",left:$(this).offset().left,top:$(this).offset().top+$(this).outerHeight(),zIndex:100}).hide().fadeTo(0,0.8);
$("body").prepend(warndiv);
//下面这段的作用是使信息弹出并停留3秒后淡出,如不需要请移除
warndiv.show("fast").animate({opacity:0.8}, 3000).fadeOut('slow',function(){$(this).remove();});
}
}
});
</script>