/* kesioncms通用脚本函数,最后更新于2012-2-9 */ //容错脚本 resumeerror=function (){return true;} window.onerror = resumeerror; //检查是否中文字符 is_zw=function(str){ exp=/[0-9a-za-z_.,#@!$%^&*()-+=|\?/<>]/g; if(str.search(exp) != -1){return false;} return true; } //验证是否包含逗号 checkbadchar=function (obj,alertstr) { exp=/[,,]/g; if(obj.value.search(exp) != -1) { alert(alertstr+"不能包含逗号"); obj.value=""; obj.focus(); return false; } return true; } // 检查是否有效的扩展名 isext=function(filename, allowext){ var stemp; var s=allowext.touppercase().split("|"); for (var i=0;i=255||charascii<=31) { errorstr=errorstr+tempstr.charat(i); } else { if (!checkerrorstr(charascii)) { errorstr=errorstr+tempstr.charat(i); } } } if (errorstr!='') { alert("出错信息:\n\n"+descriptionstr+'发现非法字符:'+errorstr); obj.focus(); return false; } if (!(((tempstr.charcodeat(0)>=48)&&(tempstr.charcodeat(0)<=57))||((tempstr.charcodeat(0)>=65)&&(tempstr.charcodeat(0)<=90))||((tempstr.charcodeat(0)>=97)&&(tempstr.charcodeat(0)<=122)))) { alert(descriptionstr+'首字符只能够为数字或者字母'); obj.focus(); return false; } } return true; } function checkerrorstr(charasciicode) { var temparray=new array(34,47,92,42,58,60,62,63,124); for (var i=0;i
'); }else{ inserthtmltoeditorbyid(editorid,'
'); } }else{ var str="
[uploadfiles]"+maxid+","+filesize+","+fileext+","+title+"[/uploadfiles]


"; if (editorid==''||editorid==undefined){ inserthtmltoeditor(str); }else{ inserthtmltoeditorbyid(editorid,str); } } } function inserthtmltoeditorbyid(editorid,codestr) {eval('ckeditor.instances.'+editorid).inserthtml(codestr);} //选择附件 var box=''; function popinsertannex(upfrom){ box=$.dialog({title:'选择附件插入',content:'url:../plus/selectannex.asp?upfrom='+upfrom,width:690,height:400}); //new kesionpopup().popupcenteriframe('选择附件插入','../plus/selectannex.asp',690,300,'no') } function getcolor(img_val,url){ var p=new kesionpopup(); p.msgborder=1; p.mousepopupiframe('选择颜色',url,210,148,'no'); } function openimgcutwindow(deloriginphoto,installdir,photourl){ openimgcutwindows(deloriginphoto,installdir,photourl,$('#photourl')[0]); } function openimgcutwindows(deloriginphoto,installdir,photourl,obj){ openthensetvalue(installdir+'plus/imgcut.asp?del='+deloriginphoto+'&photourl='+photourl,680,380,window,obj); } //网站验证码,调用 writeverifycode(安装目录,显示tips,cssname); if (typeof codenum == 'undefined'){ var codenum = 1;}else{codenum++;} function writeverifycode(dir,tips,cssname){ codenum++; if (dir==undefined) dir='/';if (tips==undefined) tips=0;if (cssname==undefined) cssname='textbox'; document.write(''); if (tips==1) document.write(' 请输入上图中字符 '); } var seccodefocus = 0; function showverifycode(id) { var obj=document.getelementbyid("codebox"+id); obj.style.top = (-parseint(obj.style.height) - 4) + 'px'; obj.style.left = '0px'; obj.style.display = ''; var pos=getelementpos("codebox"+id); if (pos.y<0) obj.style.top=parseint(obj.style.height)-20+"px"; document.getelementbyid('vcodeimg'+id).src =document.getelementbyid('vcodeimg'+id).src.split('?')[0]+'?time=' + math.random(); try{$("#codebox"+id).fadeout('fast').fadein('fast');}catch(e){} } function getelementpos(elementid) { var ua = navigator.useragent.tolowercase(); var isopera = (ua.indexof('opera') != -1); var isie = (ua.indexof('msie') != -1 && !isopera); // not opera spoof var el = document.getelementbyid(elementid); if(el.parentnode === null || el.style.display == 'none') { return false; } var parent = null;var pos = []; var box; if(el.getboundingclientrect) //ie { box = el.getboundingclientrect();var scrolltop = math.max(document.documentelement.scrolltop, document.body.scrolltop); var scrollleft = math.max(document.documentelement.scrollleft, document.body.scrollleft);return {x:box.left + scrollleft, y:box.top + scrolltop};}else if(document.getboxobjectfor) // gecko {box = document.getboxobjectfor(el); var borderleft = (el.style.borderleftwidth)?parseint(el.style.borderleftwidth):0; var bordertop = (el.style.bordertopwidth)?parseint(el.style.bordertopwidth):0; pos = [box.x - borderleft, box.y - bordertop];} else // safari & opera {pos = [el.offsetleft, el.offsettop]; parent = el.offsetparent; if (parent != el) {while (parent) {pos[0] += parent.offsetleft; pos[1] += parent.offsettop; parent = parent.offsetparent;}} if (ua.indexof('opera') != -1 || ( ua.indexof('safari') != -1 && el.style.position == 'absolute' )) { pos[0] -= document.body.offsetleft;pos[1] -= document.body.offsettop;}} if (el.parentnode) {parent = el.parentnode;} else {parent = null;} while (parent && parent.tagname != 'body' && parent.tagname != 'html') { // account for any scrolled ancestors pos[0] -= parent.scrollleft;pos[1] -= parent.scrolltop;if (parent.parentnode) {parent = parent.parentnode;} else { parent = null;}} return {x:pos[0], y:pos[1]}; } /*鼠标切换脚本*/ function scrolldoor(){ } scrolldoor.prototype = { sd : function(menus,divs,openclass,closeclass){ var _this = this; if(menus.length != divs.length) { alert("菜单层数量和内容层数量不一样!"); return false; } for(var i = 0 ; i < menus.length ; i++) { _this.$(menus[i]).value = i; _this.$(menus[i]).onmouseover = function(){ for(var j = 0 ; j < menus.length ; j++) { _this.$(menus[j]).classname = closeclass; _this.$(divs[j]).style.display = "none"; } _this.$(menus[this.value]).classname = openclass; _this.$(divs[this.value]).style.display = "block"; } } }, $ : function(oid){ if(typeof(oid) == "string") return document.getelementbyid(oid); return oid; } }