日期:2014-05-16  浏览次数:20326 次

大家帮忙看一下 调用js的这个函数为什么不出来

ui = window.ui ||{
success:function(message,error){
var style = (error==1)?"html_clew_box clew_error ":"html_clew_box";
var html   =   '<div class="" id="ui_messageBox" style="display:none;z-index:1000001">'
   + '<div class="html_clew_box_close"><a href="javascript:void(0)" onclick="$(this).parents(\'.html_clew_box\').hide()" title="关闭">关闭</a></div>'
   + '<div class="html_clew_box_con" id="ui_messageContent">&nbsp;</div></div>';
var init      =  0;

var showMessage = function( message ){
if( !init ){
$('body').append( html );
init = 1;
}



$( '#ui_messageContent' ).html( message );
$('#ui_messageBox').attr('class',style);

var v =  ui.box._viewport() ;

jQuery('<div id="boxy-modal-blackout" class="boxy-modal-blackout"><iframe style="position:absolute;_filter:alpha(opacity=0);opacity=0;z-index:-1;width:100%;height:100%;top:0;left:0;scrolling:no;" frameborder="0" src="about:blank"></iframe></div>')
        .css(jQuery.extend(ui.box._cssForOverlay(), {
            zIndex: 9999999, opacity: 0.2
        })).appendTo(document.body);


$( '#ui_messageBox' ).css({
left:( v.left + v.width/2  - $( '#ui_messageBox' ).outerWidth()/2 ) + "px",
top:(  v.top  + v.height/2 - $( '#ui_messageBox' ).outerHeight()/2 ) + "px"
});

$( '#ui_messageBox' ).fadeIn("slow");
}


var closeMessage = function(){
setTimeout( function(){  
$( '#ui_messageBox' ).fadeOut("fast",function(){
jQuery('.boxy-modal-blackout:last').remove(); 
});
} , 1500);
}

showMessage( message );
closeMessage();

},


测试例子
<a href="javascript:;"  onclick="aa()">点击</a>
<script>
  function aa(){
ui.success("添加关注话题成功");
  }
</script>