public.js.svn-base
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:8k
- //<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
- //<!--
- function OpenWin(Url,name,Width,Height) {
- var Top = (screen.height -Height)/2;
- var Left = (screen.width -Width)/2;
- return window.open(Url,name,"width=" + Width +",height=" + Height +",top=" + Top + ",left=" + Left + ",resizable=no,scrollbars=yes");
- }
- function WindowOpen(urls,name,width,height)
- {
- var l=(screen.availWidth-width)/2;
- var h=(screen.availHeight-height)/2;
- var layout='left='+l+',top='+h+',width='+width+',height='+height+',resizable=no,scrollbars=no';
- window.open(urls,'',layout);
- }
- function cmdAuth(PopedomName){ //授权
- WindowOpen('/manage/system/popedistribute/PopedomSet.jsp?PopedomName='+PopedomName,'',450,380);
- }
-
- function OpenScreen(Url,name) {
- var Top =0;
- var Left =0;
- var Width=screen.width-10;
- var Height=screen.height-60;
- return window.open(Url,name,"width=" + Width +",height=" + Height +",top=" + Top + ",left=" + Left + ",menubar=no,resizable=no,scrollbars=no");
- }
- function OpenWinDialog(Urls,name,Width,Height){
- if(window.showModalDialog(Urls,name,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;help:no;status:no"))
- self.location.reload();
- }
- function getCalendar(Field)
- {
- if (arguments.length==0){
- //如果是文本框的onmousedown世间是由脚本绑定的,且没有参数 modified by qiuchun
- if (event.srcElement){
- var pchild = event.srcElement;
- if (pchild.type && pchild.type.toLowerCase() == "text")
- arguments[0] = pchild.id;
- }
- }
- var x=event.screenX;
- var y=event.screenY;
- var result=window.showModalDialog('/manage/include/Calendar.htm','Calendar',"dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogWidth:195px;dialogHeight:200px;help:no;status:no");
- if(result!=null)
- document.all(arguments[0]).value=result;
-
- return false;
- }
- document.onkeypress=CheckLength;
- function CheckLength()
- {
- if(event.keyCode==13)
- return true;
- var str,i,strType,stagName,L;
- stagName=window.event.srcElement.tagName;
- stagName.toUpperCase(); //全部转为大写字母
- if(stagName=="INPUT" || stagName=="TEXTAREA")
- {
- strType=window.event.srcElement.type;
- strType=strType.toLowerCase();
- //alert(strtype);
- if(strType=="text" || strType=="password" || stagName=="TEXTAREA" )
- {
- var str=window.event.srcElement.value;
- i=1;
- for(var x=0;x<str.length;x++)
- {
- i++;
- if(escape(str.charAt(x)).length>4)
- {
- i++;
- }
- }
- //alert(escape(str));
- //alert(window.event.srcElement.getAttribute("maxLength"));
- L=window.event.srcElement.getAttribute("maxLength")-0;
- if (L==i-1)
- {
- window.event.keyCode =0;
- alert('最多只能输入'+L+'个字符,一个汉字相当于两个字符。');
- return false;
- }
- if(L<i-1)
- {
- window.event.keyCode =0;
- window.event.srcElement.focus();
- alert("不能输入超过输入框的限定字符数 " + L + " ;当前你已输入 " + (i-1) + " 个字符,一个汉字相当于两个字符。");
- return false;
- }
- }
- }
- }
- //==
- function CheckElements(the)
- {
-
- for(var x=0;x<the.elements.length;x++){
- if(!CheckFieldLength(the.elements[x]))
- {
- the.elements[x].focus();
- return false;
- }
- }
- return true;
- }
- function CheckFieldLength(the)
- {
- var str,i,strType,stagName,L;
- stagName=the.tagName;
- stagName=stagName.toUpperCase(); //全部转为大写字母
- if(stagName=="INPUT" || stagName=="TEXTAREA")
- {
- strType=the.type;
- strType=strType.toLowerCase();
- if(strType=="text" || strType=="password" || stagName=="TEXTAREA")
- {
- var str=the.value;
- i=1;
- for(var x=0;x<str.length;x++)
- {
- i++;
- if(escape(str.charAt(x)).length>4)
- {
- i++;
- }
- }
- L=the.getAttribute("maxLength")-0;
- if(L<i-1)
- {
- alert('此输入框最多只能输入 '+L+' 个字符;您输入的数据现在多出了 '+(i-1-L)+' 个字符;一个汉字相当于两个字符。');
- return false;
- }
- }
- }
- return true;
- }
- function keyPress(the)
- {
- key=window.event.keyCode;
- if (key==38)
- {
- CurTabIndex=event.srcElement.tabIndex-1;
- for (n=0;n<the.elements.length;n++)
- {
- if (the.elements[n].tabIndex==CurTabIndex)
- {
- the.elements[n].focus();
- return true;
- }
- }
- }
- if (key==40 || key==13)
- {
- CurTabIndex=event.srcElement.tabIndex+1;
- for (n=0;n<the.elements.length;n++)
- {
- if (the.elements[n].tabIndex==CurTabIndex)
- {
- try{
- the.elements[n].focus();
- }
- catch(e)
- {
- ;
- }
- return true;
- }
- }
- }
- }
- function Init()
- {
- formInit(form1);
- }
- function formInit(the)
- {
- the.elements[0].focus();
- for (var n=0;n<the.elements.length;n++)
- {
- the.elements[n].tabIndex=n;
- }
- }
- //选择一条数据
- document.onmouseover= bover;
- document.onmouseout= bout;
- document.onmousedown=bdown;
- document.onmouseup=bup;
- var temp=new Array();
- var SelectedId = "" ;
- var tempii=0;
- tempyangn=0;
- tempyang="";
- tempcal=0;
- function bover(){
-
- var el=event.srcElement;
- var elp=el.parentElement;
- if(elp.className=='coolbutton'){raisebutton(elp)}
- if(el.className=='coolbutton'){raisebutton(el);}
- }
- function bout(){
- var el=event.srcElement;
- var elp=el.parentElement;
- if(elp.className=='coolbutton'){normalbutton(elp)}
- if(el.className=='coolbutton'){normalbutton(el);}
- if(elp.className=='coolbutton-up'){raisebutton(elp)}
- if(el.className=='coolbutton-up'){raisebutton(el)}
- }
- function bdown(){
- var el=event.srcElement;
- if(el.tagName=='IMG'){
- var elp=el.parentElement.parentElement;
- }else{
- var elp=el.parentElement;
- }
- /* if(elp.tagName=='TR'||elp.tagName=='tr'){
- for (var ii=0;ii<elp.children.length;ii++){
- elp.children[ii].style.background='#ECECEC';
- elp.children[ii].style.color='#000000';
- }
- }*/
- if((event.button==1) && (elp.className=='coolselect')){
- var ellength=elp.children.length
- tempiik=tempii-1
- if(temp[tempiik]){
- for(var iii=0;iii<=tempiik;iii++){
- for (var ii=0;ii<ellength;ii++){
- temp[iii].children[ii].style.background='#ECECEC';
- temp[iii].children[ii].style.color='#000000';
- }
- temp[iii] = "" ;
- }
- tempii=0;
- }
- if(elp.tagName=='TR'||elp.tagName=='tr'){
- for (var ii=0;ii<ellength;ii++){
- elp.children[ii].style.background='highlight';
- elp.children[ii].style.color='#ffffff';
- }
- temp[tempii]=eval(elp);
- tempii++;
- }
- }
-
- var elp=el.parentElement;
- if(elp.className=='coolbutton'){pressedbutton(elp)}
- if(el.className=='coolbutton'){pressedbutton(el)}
- if(elp.className=='coolbutton-up'){pressedbutton(elp)}
- if(el.className=='coolbutton-up'){pressedbutton(el)}
- if(tempyangn==1){
- tempyang.style.color='#000000'}
- }
- function bup(){
- var el=event.srcElement;
- var elp=el.parentElement;
- if(elp.className=='coolbutton'){raisebutton(elp)}
- if(el.className=='coolbutton'){raisebutton(el)}
- if(elp.className=='coolbutton-up'){raisebutton(elp)}
- if(el.className=='coolbutton-up'){raisebutton(el)}
- }
- function pressedbutton(el) {
- el.style.borderTop ="1 solid buttonshadow";
- // el.style.paddingTop = "2";
- el.style.borderLeft ="1 solid buttonshadow";
- // el.style.paddingLeft = "8";
- el.style.borderBottom ="1 solid buttonhighlight";
- // el.style.paddingBottom= "0";
- el.style.borderRight = "1 solid buttonhighlight";
- // el.style.paddingRight = "6";
- el.style.background='buttonface'
- }
- function normalbutton(el){
- el.style.border="1 solid buttonface"
- el.style.background='buttonface'
- el.style.paddingLeft = "4";
- el.style.paddingRight = "4";
- if (el.children[0]){
- el.children[0].style.filter="gray()";
- }
- }
- function raisebutton(el) {
- el.style.borderTop ="1 solid buttonhighlight";
- el.style.borderLeft ="1 solid buttonhighlight";
- el.style.borderBottom ="1 solid buttonshadow";
- el.style.borderRight ="1 solid buttonshadow";
- // el.style.padding ="1";
- el.style.paddingLeft = "4";
- el.style.paddingRight = "4";
- el.style.background='buttonface'
- if (el.children[0]){
- el.children[0].style.filter=""
- }
- }
- //-->
- //</SCRIPT>