public.js
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:8k
源码类别:

WEB邮件程序

开发平台:

Java

  1. //<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
  2. //<!--
  3. function OpenWin(Url,name,Width,Height) {
  4. var Top = (screen.height -Height)/2;
  5. var Left = (screen.width -Width)/2;
  6. return window.open(Url,name,"width=" + Width +",height=" + Height +",top=" + Top + ",left=" + Left + ",resizable=no,scrollbars=yes");
  7. }
  8. function WindowOpen(urls,name,width,height)
  9. {
  10. var l=(screen.availWidth-width)/2;
  11. var h=(screen.availHeight-height)/2;
  12. var layout='left='+l+',top='+h+',width='+width+',height='+height+',resizable=no,scrollbars=no';
  13. window.open(urls,'',layout);
  14. }
  15. function cmdAuth(PopedomName){   //授权 
  16. WindowOpen('/manage/system/popedistribute/PopedomSet.jsp?PopedomName='+PopedomName,'',450,380);
  17. }
  18.  
  19. function OpenScreen(Url,name) {
  20. var Top =0;
  21. var Left =0;
  22. var Width=screen.width-10;
  23. var Height=screen.height-60;
  24. return window.open(Url,name,"width=" + Width +",height=" + Height +",top=" + Top + ",left=" + Left + ",menubar=no,resizable=no,scrollbars=no");
  25. }
  26. function OpenWinDialog(Urls,name,Width,Height){
  27. if(window.showModalDialog(Urls,name,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;help:no;status:no"))
  28. self.location.reload();
  29. }
  30. function getCalendar(Field)
  31. {
  32.     if (arguments.length==0){
  33.   //如果是文本框的onmousedown世间是由脚本绑定的,且没有参数  modified by qiuchun
  34.   if (event.srcElement){
  35.     var pchild = event.srcElement;
  36.     if (pchild.type && pchild.type.toLowerCase() == "text")
  37.       arguments[0] = pchild.id;
  38.   }
  39. }
  40. var x=event.screenX;
  41. var y=event.screenY;
  42. var result=window.showModalDialog('/manage/include/Calendar.htm','Calendar',"dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogWidth:195px;dialogHeight:200px;help:no;status:no");
  43. if(result!=null)
  44. document.all(arguments[0]).value=result;
  45. return false;
  46. }
  47. document.onkeypress=CheckLength;
  48. function CheckLength()
  49. {
  50. if(event.keyCode==13)
  51. return true;
  52. var str,i,strType,stagName,L;
  53. stagName=window.event.srcElement.tagName;
  54. stagName.toUpperCase(); //全部转为大写字母
  55. if(stagName=="INPUT" || stagName=="TEXTAREA")
  56. {
  57. strType=window.event.srcElement.type;
  58. strType=strType.toLowerCase();
  59. //alert(strtype);
  60. if(strType=="text" || strType=="password" || stagName=="TEXTAREA" )
  61. {
  62. var str=window.event.srcElement.value;
  63. i=1;
  64. for(var x=0;x<str.length;x++)
  65. {
  66. i++;
  67. if(escape(str.charAt(x)).length>4)
  68. {
  69. i++;
  70. }
  71. }
  72. //alert(escape(str));
  73. //alert(window.event.srcElement.getAttribute("maxLength"));
  74. L=window.event.srcElement.getAttribute("maxLength")-0;
  75. if (L==i-1)
  76. {
  77. window.event.keyCode =0;
  78. alert('最多只能输入'+L+'个字符,一个汉字相当于两个字符。');
  79. return false;
  80. }
  81. if(L<i-1)
  82. {
  83. window.event.keyCode =0;
  84. window.event.srcElement.focus();
  85. alert("不能输入超过输入框的限定字符数 " + L + " ;当前你已输入 " + (i-1) + " 个字符,一个汉字相当于两个字符。");
  86. return false;
  87. }
  88. }
  89. }
  90. }
  91. //==
  92. function CheckElements(the)
  93. {
  94.         
  95. for(var x=0;x<the.elements.length;x++){
  96. if(!CheckFieldLength(the.elements[x]))
  97. {
  98. the.elements[x].focus();
  99. return false;
  100. }
  101. }
  102. return true;
  103. }
  104. function CheckFieldLength(the)
  105. {
  106. var str,i,strType,stagName,L;
  107. stagName=the.tagName;
  108. stagName=stagName.toUpperCase(); //全部转为大写字母
  109. if(stagName=="INPUT" || stagName=="TEXTAREA")
  110. {
  111. strType=the.type;
  112. strType=strType.toLowerCase();
  113. if(strType=="text" || strType=="password" || stagName=="TEXTAREA")
  114. {
  115. var str=the.value;
  116. i=1;
  117. for(var x=0;x<str.length;x++)
  118. {
  119. i++;
  120. if(escape(str.charAt(x)).length>4)
  121. {
  122. i++;
  123. }
  124. }
  125. L=the.getAttribute("maxLength")-0;
  126. if(L<i-1)
  127. {
  128. alert('此输入框最多只能输入 '+L+' 个字符;您输入的数据现在多出了 '+(i-1-L)+' 个字符;一个汉字相当于两个字符。');
  129. return false;
  130. }
  131. }
  132. }
  133. return true;
  134. }
  135. function keyPress(the)
  136. {
  137. key=window.event.keyCode;
  138. if (key==38)
  139. {
  140. CurTabIndex=event.srcElement.tabIndex-1;
  141. for (n=0;n<the.elements.length;n++)
  142. {
  143. if (the.elements[n].tabIndex==CurTabIndex)
  144. {
  145. the.elements[n].focus();
  146. return true;
  147. }
  148. }
  149.     }
  150. if (key==40 || key==13)
  151. {
  152. CurTabIndex=event.srcElement.tabIndex+1;
  153. for (n=0;n<the.elements.length;n++)
  154. {
  155. if (the.elements[n].tabIndex==CurTabIndex)
  156. {
  157. try{
  158. the.elements[n].focus();
  159. }
  160. catch(e)
  161. {
  162. ;
  163. }
  164. return true;
  165. }
  166. }
  167. }
  168. }
  169. function Init()
  170. {
  171. formInit(form1);
  172. }
  173. function formInit(the)
  174. {
  175. the.elements[0].focus();
  176. for (var n=0;n<the.elements.length;n++)
  177. {
  178.     the.elements[n].tabIndex=n;
  179. }
  180. }
  181. //选择一条数据
  182. document.onmouseover= bover;
  183. document.onmouseout= bout;
  184. document.onmousedown=bdown;
  185. document.onmouseup=bup;
  186. var temp=new Array();
  187. var SelectedId = "" ;
  188. var tempii=0;
  189. tempyangn=0;
  190. tempyang="";
  191. tempcal=0;
  192. function bover(){
  193.   
  194. var el=event.srcElement;
  195. var elp=el.parentElement;
  196.     if(elp.className=='coolbutton'){raisebutton(elp)}
  197. if(el.className=='coolbutton'){raisebutton(el);}
  198. }
  199. function bout(){
  200.     var el=event.srcElement;
  201. var elp=el.parentElement;
  202.     if(elp.className=='coolbutton'){normalbutton(elp)}
  203. if(el.className=='coolbutton'){normalbutton(el);}
  204.     if(elp.className=='coolbutton-up'){raisebutton(elp)}
  205. if(el.className=='coolbutton-up'){raisebutton(el)}
  206. }
  207. function bdown(){
  208.     var el=event.srcElement;
  209. if(el.tagName=='IMG'){
  210.   var elp=el.parentElement.parentElement;
  211. }else{
  212.   var elp=el.parentElement;
  213. }
  214. /*  if(elp.tagName=='TR'||elp.tagName=='tr'){
  215.        for (var ii=0;ii<elp.children.length;ii++){
  216.      elp.children[ii].style.background='#ECECEC';
  217.      elp.children[ii].style.color='#000000';
  218.  }
  219.    }*/
  220.     if((event.button==1) && (elp.className=='coolselect')){
  221.   var ellength=elp.children.length
  222.   tempiik=tempii-1
  223.   if(temp[tempiik]){
  224.    for(var iii=0;iii<=tempiik;iii++){ 
  225.     for (var ii=0;ii<ellength;ii++){
  226.       temp[iii].children[ii].style.background='#ECECEC';
  227.       temp[iii].children[ii].style.color='#000000';
  228.     }
  229.       temp[iii] = "" ;
  230.    }
  231.    tempii=0;
  232.   }
  233.   if(elp.tagName=='TR'||elp.tagName=='tr'){
  234.        for (var ii=0;ii<ellength;ii++){
  235.      elp.children[ii].style.background='highlight';
  236.      elp.children[ii].style.color='#ffffff';
  237.    }
  238.    temp[tempii]=eval(elp);
  239.    tempii++;
  240.   }
  241.     }
  242.     var elp=el.parentElement;
  243.     if(elp.className=='coolbutton'){pressedbutton(elp)}
  244. if(el.className=='coolbutton'){pressedbutton(el)}
  245.     if(elp.className=='coolbutton-up'){pressedbutton(elp)}
  246. if(el.className=='coolbutton-up'){pressedbutton(el)}
  247. if(tempyangn==1){
  248. tempyang.style.color='#000000'}
  249. }
  250. function bup(){
  251.     var el=event.srcElement;
  252.     var elp=el.parentElement;
  253.     if(elp.className=='coolbutton'){raisebutton(elp)}
  254. if(el.className=='coolbutton'){raisebutton(el)}
  255.     if(elp.className=='coolbutton-up'){raisebutton(elp)}
  256. if(el.className=='coolbutton-up'){raisebutton(el)}
  257. }
  258. function pressedbutton(el) {
  259. el.style.borderTop ="1 solid buttonshadow";
  260. // el.style.paddingTop = "2";
  261. el.style.borderLeft ="1 solid buttonshadow";
  262. // el.style.paddingLeft = "8";
  263. el.style.borderBottom ="1 solid buttonhighlight";
  264. // el.style.paddingBottom= "0";
  265. el.style.borderRight = "1 solid buttonhighlight";
  266. // el.style.paddingRight = "6";
  267.     el.style.background='buttonface'
  268. }
  269. function normalbutton(el){
  270.     el.style.border="1 solid buttonface"
  271.     el.style.background='buttonface'
  272. el.style.paddingLeft = "4";
  273. el.style.paddingRight = "4";
  274.     if (el.children[0]){
  275.      el.children[0].style.filter="gray()";
  276. }
  277. }
  278. function raisebutton(el) {
  279. el.style.borderTop ="1 solid buttonhighlight";
  280. el.style.borderLeft ="1 solid buttonhighlight";
  281. el.style.borderBottom ="1 solid buttonshadow";
  282. el.style.borderRight ="1 solid buttonshadow";
  283. // el.style.padding ="1";
  284. el.style.paddingLeft = "4";
  285. el.style.paddingRight = "4";
  286.     el.style.background='buttonface'
  287.     if (el.children[0]){
  288.     el.children[0].style.filter=""
  289. }
  290. }
  291. //-->
  292. //</SCRIPT>