function openwinx(url,name,w,h) { window.open(url,name,"top=100,left=400,width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no"); } function dialog(url,name,w,h) { return showmodaldialog(url, name, 'dialogwidth:'+w+'px; dialogheight:'+h+'px; help: no; scroll: yes; status: no'); } function redirect(url) { if(url.lastindexof('/.') > 0) { url = url.replace(/\/(\.[a-za-z]+)([0-9]+)$/g, "/$2$1"); } else if(url.match(/\/([a-z]+).html([0-9]+)$/)) { url = url.replace(/\/([a-z]+).html([0-9]+)$/, "/$1-$2.html"); } else if(url.match(/-.html([0-9]+)$/)) { url = url.replace(/-.html([0-9]+)$/, "-$1.html"); } if(url.indexof('://') == -1 && url.substr(0, 1) != '/' && url.substr(0, 1) != '?') url = $('base').attr('href')+url; location.href = url; } //添加收藏夹 function myaddpanel(title,url) { if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addpanel == 'function')) { window.sidebar.addpanel(title,url,""); } else { window.external.addfavorite(url,title); } } function confirmurl(url,message) { if(confirm(message)) redirect(url); } function confirmform(form,message) { if(confirm(message)) form.submit(); } function getcookie(name) { name = cookie_pre+name; var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while(i < clen) { var j = i + alen; if(document.cookie.substring(i, j) == arg) return getcookieval(j); i = document.cookie.indexof(" ", i) + 1; if(i == 0) break; } return null; } function setcookie(name, value, days) { name = cookie_pre+name; var argc = setcookie.arguments.length; var argv = setcookie.arguments; var secure = (argc > 5) ? argv[5] : false; var expire = new date(); if(days==null || days==0) days=1; expire.settime(expire.gettime() + 3600000*24*days); document.cookie = name + "=" + escape(value) + ("; path=" + cookie_path) + ((cookie_domain == '') ? "" : ("; domain=" + cookie_domain)) + ((secure == true) ? "; secure" : "") + ";expires="+expire.togmtstring(); } function delcookie(name) { var exp = new date(); exp.settime (exp.gettime() - 1); var cval = getcookie(name); name = cookie_pre+name; document.cookie = name+"="+cval+";expires="+exp.togmtstring(); } function getcookieval(offset) { var endstr = document.cookie.indexof (";", offset); if(endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function checkall(fieldid) { if(fieldid==null) { if($('#checkbox').attr('checked')==false) { $('input[type=checkbox]').attr('checked',true); } else { $('input[type=checkbox]').attr('checked',false); } } else { var fieldids = '#'+fieldid; var inputfieldids = 'input[boxid='+fieldid+']'; if($(fieldids).attr('checked')==false) { $(inputfieldids).attr('checked',true); } else { $(inputfieldids).attr('checked',false); } } } function checkradio(radio) { var result = false; for(var i=0; i0 && image.height>0) { flag=true; if(image.width/image.height>= w/h) { if(image.width>w) { imgd.width=w; imgd.height=(image.height*w)/image.width; imgd.style.display="block"; }else{ imgd.width=image.width; imgd.height=image.height; imgd.style.display="block"; } }else{ if(image.height>h) { imgd.height=h; imgd.width=(image.width*h)/image.height; imgd.style.display="block"; }else{ imgd.width=image.width; imgd.height=image.height; imgd.style.display="block"; } } } } var browser = new object(); browser.ismozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createdocument != 'undefined') && (typeof htmldocument!='undefined'); browser.isie = window.activexobject ? true : false; browser.isfirefox = (navigator.useragent.tolowercase().indexof("firefox")!=-1); browser.issafari = (navigator.useragent.tolowercase().indexof("safari")!=-1); browser.isopera = (navigator.useragent.tolowercase().indexof("opera")!=-1); var common = new object(); common.htmlencode = function(str) { return str.replace(/&/g, '&').replace(/"/g, '"').replace(//g, '>'); } common.trim = function(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } common.strlen = function (str) { if(browser.isfirefox) { charset = document.characterset; } else { charset = document.charset; } if(charset.tolowercase() == 'utf-8') { return str.replace(/[\u4e00-\u9fa5]/g, "***").length; } else { return str.replace(/[^\x00-\xff]/g, "**").length; } } common.isdate = function (str) { var result=str.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2})$/); if(result==null) return false; var d=new date(result[1], result[3]-1, result[4]); return (d.getfullyear()==result[1] && d.getmonth()+1==result[3] && d.getdate()==result[4]); } common.isnumber = function(val) { var reg = /[\d|\.|,]+/; return reg.test(val); } common.isalphanumber = function (str) { var result=str.match(/^[a-za-z0-9]+$/); if(result==null) return false; return true; } common.isint = function(val) { var reg = /\d+/; return reg.test(val); } common.isemail = function(email) { var reg = /([\w|_|\.|\+]+)@([-|\w]+)\.([a-za-z]{2,4})/; return reg.test( email ); } common.fixeventargs = function(e) { var evt = (typeof e == "undefined") ? window.event : e; return evt; } common.srcelement = function(e) { if (typeof e == "undefined") e = window.event; var src = document.all ? e.srcelement : e.target; return src; } common.isdatetime = function(val) { var result=str.match(/^(\d{4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/); if(result==null) return false; var d= new date(result[1], result[3]-1, result[4], result[5], result[6], result[7]); return (d.getfullyear()==result[1]&&(d.getmonth()+1)==result[3]&&d.getdate()==result[4]&&d.gethours()==result[5]&&d.getminutes()==result[6]&&d.getseconds()==result[7]); } var filenum = 1; function addinputfile(field) { filenum++; var filetag = "
"; var fileobj = document.createelement("div"); fileobj.id = 'file_'+filenum; fileobj.innerhtml = filetag; document.getelementbyid("file_div").appendchild(fileobj); } function delinputfile(filenum) { var delobj = document.getelementbyid("file_"+filenum); document.getelementbyid("file_div").removechild(delobj); } function filepreview(url, isshow) { obj = document.getelementbyid('filepreview'); if(isshow) { obj.style.left = event.clientx+80; obj.style.top = event.clienty+20; obj.innerhtml = ""; obj.style.display = 'block'; } else { obj.style.display = 'none'; } } function seteditorsize(editorid,flag) { var minheight = 400; var step = 150; var e=$('#'+editorid); var h =parseint(e.height()); if(!flag && h本功能只支持ie浏览器,请用ie浏览器打开。
'); } } function select_catids() { $('#addbutton').attr('disabled',''); } function transact(update,fromfiled,tofiled) { if(update=='delete') { var fieldvalue = $('#'+tofiled).val(); $("select[@id="+tofiled+"] option").each(function() { if($(this).val() == fieldvalue){ $(this).remove(); } }); } else { var fieldvalue = $('#'+fromfiled).val(); var have_exists = 0; var len = $("select[@id="+tofiled+"] option").length; if(len>5) { alert('最多添加 6 项'); return false; } $("select[@id="+tofiled+"] option").each(function() { if($(this).val() == fieldvalue){ have_exists = 1; alert('已经添加到列表中'); return false; } }); if(have_exists==0) { fieldvalue = "" $('#'+tofiled).append(fieldvalue); $('#deletebutton').attr('disabled',''); } } } var set_show = false;