function echolist(theid,length){ var s="imore_c_s_"+theid; var n="imore_c_n_"+theid; if(length<=100) length=100; if(document.getelementbyid(n).innertext.length<=length) document.getelementbyid(s).innerhtml="  "+document.getelementbyid(n).innertext; else document.getelementbyid(s).innerhtml+=("  "+document.getelementbyid(n).innertext).substr(0,length); document.getelementbyid(s).innerhtml+="...  [详细信息]"; } function gouserlogin(){ window.location="user_login_bypassword.php"; } function read(tform,notemptyignore) { var str,ename,ecol,val,en; for(var i=0;i document.body.offsetheight) { // all but explorer mac xscroll = document.body.scrollwidth; yscroll = document.body.scrollheight; } else { // explorer mac...would also work in explorer 6 strict, mozilla and safari xscroll = document.body.offsetwidth; yscroll = document.body.offsetheight; } if (self.innerheight) { // all except explorer windowwidth = self.innerwidth; windowheight = self.innerheight; } else if (document.documentelement && document.documentelement.clientheight) { // explorer 6 strict mode windowwidth = document.documentelement.clientwidth; windowheight = document.documentelement.clientheight; } else if (document.body) { // other explorers windowwidth = document.body.clientwidth; windowheight = document.body.clientheight; } // for small pages with total height less then height of the viewport if (yscroll < windowheight) { pageheight = windowheight; } else { pageheight = yscroll; } // for small pages with total width less then width of the viewport if (xscroll < windowwidth) { pagewidth = windowwidth; } else { pagewidth = xscroll; } return{ 'pagewidth':pagewidth, 'pageheight':pageheight, 'windowwidth':windowwidth, 'windowheight':windowheight } }(); //alert(winsize.pageheight); //遮罩层 var stylestr = 'top:0;left:0;position:absolute;z-index:10000;background:#666;width: 100%;height:'+winsize.pageheight+'px;'; stylestr += (isie) ? "filter:alpha(opacity=80);" : "opacity:0.8;"; //遮罩层div var shadowdiv = document.createelement('div'); //添加阴影div shadowdiv.style.csstext = stylestr; //添加样式 shadowdiv.id = "shadowdiv"; //如果是ie6则创建iframe遮罩select if (isie6) { var maskiframe = document.createelement('iframe'); maskiframe.style.csstext = 'width:' + winsize.pagewidth + 'px;height:' + (winsize.pageheight + 30) + 'px;position:absolute;visibility:inherit;z-index:-1;filter:alpha(opacity=0);'; maskiframe.frameborder = 0; maskiframe.src = "about:blank"; shadowdiv.appendchild(maskiframe); } document.body.insertbefore(shadowdiv, document.body.firstchild); //遮罩层加入文档 //弹出框 var stylestr1 = 'display:block;position:fixed;_position:absolute;z-index:10001;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);-moz-transform: translate(-50%, -50%);-ms-transform: translate(-50%, -50%);-o-transform: translate(-50%, -50%);transform: translate(-50%, -50%);'; //弹出框的位置 var alertbox = document.createelement('div'); alertbox.id = 'alertmsg'; alertbox.style.csstext = stylestr1; //创建弹出框里面的内容p标签 var alertmsg_info = document.createelement('p'); alertmsg_info.id = 'alertmsg_info'; alertmsg_info.innerhtml = msg; alertbox.appendchild(alertmsg_info); //创建按钮 var btn1 = document.createelement('a'); btn1.id = 'alertmsg_btn1'; btn1.href = 'javas' + 'cript:void(0)'; btn1.innerhtml = '确定'; btn1.onclick = function () { document.body.removechild(alertbox); document.body.removechild(shadowdiv); return true; }; alertbox.appendchild(btn1); if (mode === 1) { var btn2 = document.createelement('a'); btn2.id = 'alertmsg_btn2'; btn2.href = 'javas' + 'cript:void(0)'; btn2.innerhtml = '取消'; btn2.onclick = function () { document.body.removechild(alertbox); document.body.removechild(shadowdiv); return false; }; alertbox.appendchild(btn2); } document.body.appendchild(alertbox); } //mode为空,即只有一个确认按钮,mode为1时有确认和取消两个按钮 function showprocess(){ var childdiv= document.createelement("div"); //childdiv.setattribute("class","div_file_unit" ); //获取浏览器页面可见高度和宽度 var _pageheight = document.documentelement.clientheight, _pagewidth = document.documentelement.clientwidth; //计算loading框距离顶部和左部的距离(loading框的宽度为215px,高度为61px) var _loadingtop = _pageheight > 61 ? (_pageheight - 61) / 2 : 0, _loadingleft = _pagewidth > 111 ? (_pagewidth - 111) / 2 : 0; //在页面未加载完毕之前显示的loading html自定义内容 var _loadinghtml = '
处理中...
'; //呈现loading效果 //document.write(_loadinghtml); var stylestr = 'position:fixed;left:0px;width:100%;height:100%;top:0px;background:#000000;opacity:0.9;filter:alpha(opacity=90);z-index:10000;'; childdiv.id = "loadingdiv"; childdiv.setattribute("id","loadingdiv"); childdiv.style.csstext = stylestr; childdiv.innerhtml = _loadinghtml; //document.body.insertbefore(childdiv, document.body.firstchild); document.body.appendchild(childdiv); } function clearprocess(){ var childdiv = document.getelementbyid("loadingdiv"); if(childdiv) document.body.removechild(childdiv); } function alerttoast(msg){ var childdiv = document.createelement("div"); childdiv.setattribute("class","toast-wrap"); childdiv.innerhtml=""; document.body.appendchild(childdiv); settimeout(function(){ document.getelementsbyclassname('toast-wrap')[0].getelementsbyclassname('toast-msg')[0].innerhtml=msg; var toasttag = document.getelementsbyclassname('toast-wrap')[0]; toasttag.classname = toasttag.classname.replace('toastanimate',''); settimeout(function(){ toasttag.classname = toasttag.classname + ' toastanimate'; }, 100); }, 500 ); settimeout(function(){ document.body.removechild(childdiv); }, 2000 ); } //============================================ (function($) { $.alerts = { alert: function(title, message, callback) { if( title == null ) title = 'alert'; $.alerts._show(title, message, null, 'alert', function(result) { if( callback ) callback(result); }); }, confirm: function(title, message, callback) { if( title == null ) title = 'confirm'; $.alerts._show(title, message, null, 'confirm', function(result) { if( callback ) callback(result); }); }, _show: function(title, msg, value, type, callback) { var _html = ""; _html += '
' + title + ''; _html += '
' + msg + '
'; if (type == "alert") { _html += ''; } if (type == "confirm") { _html += ''; _html += ''; } _html += '
'; //必须先将_html添加到body,再设置css样式 $("body").append(_html); generatecss(); switch( type ) { case 'alert': $("#mb_btn_ok").click( function() { $.alerts._hide(); callback(true); }); $("#mb_btn_ok").focus().keypress( function(e) { if( e.keycode == 13 || e.keycode == 27 ) $("#mb_btn_ok").trigger('click'); }); break; case 'confirm': $("#mb_btn_ok").click( function() { $.alerts._hide(); if( callback ) callback(true); }); $("#mb_btn_no").click( function() { $.alerts._hide(); if( callback ) callback(false); }); $("#mb_btn_no").focus(); $("#mb_btn_ok, #mb_btn_no").keypress( function(e) { if( e.keycode == 13 ) $("#mb_btn_ok").trigger('click'); if( e.keycode == 27 ) $("#mb_btn_no").trigger('click'); }); break; } }, _hide: function() { $("#mb_box,#mb_con").remove(); } } // shortuct functions myalert = function(title, message, callback) { $.alerts.alert(title, message, callback); } myconfirm = function(title, message, callback) { $.alerts.confirm(title, message, callback); }; //生成css var generatecss = function () { $("#mb_box").css({ width: '100%', height: '100%', zindex: '99999', position: 'fixed', filter: 'alpha(opacity=60)', backgroundcolor: 'black', top: '0', left: '0', opacity: '0.6' }); $("#mb_con").css({ zindex: '999999', width: '350px',height:'200px', position: 'fixed', backgroundcolor: 'white', }); $("#mb_tit").css({ display: 'block', fontsize: '14px', color: '#444', padding: '10px 15px', backgroundcolor: '#fff', borderradius: '15px 15px 0 0', fontweight: 'bold' }); $("#mb_msg").css({ padding: '20px', lineheight: '40px', textalign:'center', fontsize: '18px' ,color:'#4c4c4c' }); $("#mb_ico").css({ display: 'block', position: 'absolute', right: '10px', top: '9px', border: '1px solid gray', width: '18px', height: '18px', textalign: 'center', lineheight: '16px', cursor: 'pointer', borderradius: '12px', fontfamily: '微软雅黑' }); $("#mb_btnbox").css({ margin: '15px 0px 10px 0', textalign: 'center' }); $("#mb_btn_ok,#mb_btn_no").css({ width: '80px', height: '30px', color: 'white', border: 'none', borderradius:'4px'}); $("#mb_btn_ok").css({ backgroundcolor: '#41a259' }); $("#mb_btn_no").css({ backgroundcolor: 'gray', marginright: '40px' }); //右上角关闭按钮hover样式 $("#mb_ico").hover(function () { $(this).css({ backgroundcolor: 'red', color: 'white' }); }, function () { $(this).css({ backgroundcolor: '#ddd', color: 'black' }); }); var _widht = document.documentelement.clientwidth; //屏幕宽 var _height = document.documentelement.clientheight; //屏幕高 var boxwidth = $("#mb_con").width(); var boxheight = $("#mb_con").height(); //alert(_height); //让提示框居中 $("#mb_con").css({ top: (boxheight) / 2 + "px", left: (_widht - boxwidth) / 2 + "px" }); } })(jquery);