JS之经典代码段续二

  1. /*根据元素ID查找元素*/
  2. function $() {
  3. var elements = new Array();
  4. for (var i = 0; i < arguments.length; i++) {
  5. var element = arguments[i];
  6. if (typeof element == 'string')
  7. element = document.getElementById(element);
  8. if (arguments.length == 1)
  9. return element;
  10. elements.push(element);
  11. }
  12. return elements;
  13. }
  14. /*根据元素ID取得元素*/
  15. function $E(elemid) {
  16. return document.getElementById(elemid);
  17. }
  18. /*根据元素ID取得元素的value*/
  19. function $Vo(elemid) {
  20. return document.getElementById(elemid).value;
  21. }
  22. /*根据元素ID取得元素的innerHTML*/
  23. function $H(elemid) {
  24. return document.getElementById(elemid).innerHTML;
  25. }
  26. /*根据元素ID隐藏该元素*/
  27. function $Hide(id) {
  28. document.getElementById(id).style.display = 'none';
  29. }
  30. /*根据元素ID显示该元素*/
  31. function $Display(id) {
  32. document.getElementById(id).style.display = 'block';
  33. }
  34. /*根据元素ID设置该元素为空*/
  35. function $Dlose(id) {
  36. document.getElementById(id).innerHTML='';
  37. }
  38. /*网页转向*/
  39. function $U(url){
  40. window.location.href=url;
  41. }
  42. /*取字符长度,一个中文字符为两个字节*/
  43. function $Len(str){
  44. return (''+str).replace(/[^/x0000-/xFF00]/gi,'xx').length;
  45. }
  46. //用正则表达式将前后空格用空字符串替代。
  47. function trim(strSrc)
  48. {
  49. return strSrc.replace(/(^/s*)|(/s*$)/g, "");
  50. }
  51. //onkeypress时根据输入类型控制输入字符,"F":浮点型 "I":整型 "D":日期型
  52. function filterKey(sType){
  53. var iKey = window.event.keyCode;
  54. if(sType == "F"){ //浮点型
  55. if(iKey != 45 && iKey != 46 && iKey != 13 && iKey != 11 && !(iKey>=48 && iKey<=57))
  56. window.event.keyCode = 0
  57. else{
  58. if(iKey == 46){
  59. var obj = window.event.srcElement;
  60. if(obj.value.indexOf(".")>=0)
  61. window.event.keyCode = 0;
  62. }
  63. if(iKey == 45){
  64. var obj = window.event.srcElement;
  65. if(obj.value.indexOf("-")>=0)
  66. window.event.keyCode = 0;
  67. else{
  68. window.event.keyCode = 0;
  69. obj.value = "-" + obj.value;
  70. if(obj.onchange != null){
  71. obj.onchange();
  72. }
  73. }
  74. }
  75. }
  76. } //end "F"
  77. else if(sType == "I"){ //整型
  78. if(iKey != 13 && iKey != 45 && iKey != 11 && !(iKey>=48 && iKey<=57))
  79. window.event.keyCode = 0;
  80. else if(iKey == 45){
  81. var obj = window.event.srcElement;
  82. if(obj.value.indexOf("-")>=0)
  83. window.event.keyCode = 0;
  84. else{
  85. window.event.keyCode = 0;
  86. obj.value = "-" + obj.value;
  87. if(obj.onchange != null){
  88. obj.onchange();
  89. }
  90. }
  91. }
  92. } // end "I"
  93. else if(sType == "D"){ //日期型
  94. var obj = window.event.srcElement;
  95. var strDate = obj.value;
  96. if(strDate.length>=10){
  97. window.event.keyCode = 0;
  98. return;
  99. }
  100. else if(strDate.length<4){ //年
  101. if(iKey != 13 && iKey != 11 && !(iKey>=48 && iKey<=57))
  102. window.event.keyCode = 0;
  103. }
  104. else if(strDate.length == 4){ //分隔符
  105. if(iKey != 45 && iKey != 47)
  106. window.event.keyCode = 0;
  107. }
  108. else if(strDate.length>=5){
  109. if( strDate.indexOf("-") > 0 && strDate.indexOf("-") == strDate.lastIndexOf("-")){ //正输入月份
  110. if(strDate.length>=7 && iKey != 45){ //如果长度过长,则退出
  111. window.event.keyCode = 0;
  112. return;
  113. }
  114. if(iKey>=48 && iKey<=57){
  115. var iPos = strDate.indexOf("-");
  116. var iMonth = parseInt("" + strDate.substr(iPos+1,strDate.length-iPos-1) + (parseInt(iKey) - 48));
  117. if(strDate.length>=6 && (iMonth <1 || iMonth > 12)){
  118. window.event.keyCode = 0;
  119. return;
  120. }
  121. }
  122. } // end if("-")
  123. else if( strDate.indexOf("/") > 0 && strDate.indexOf("/") == strDate.lastIndexOf("/")){ //正输入月份
  124. if(strDate.length>=7 && iKey != 47){ //如果长度过长,则退出
  125. window.event.keyCode = 0;
  126. return;
  127. }
  128. if(iKey>=48 && iKey<=57){
  129. var iPos = strDate.indexOf("/");
  130. var iMonth = parseInt("" + strDate.substr(iPos+1,strDate.length-iPos-1) + (parseInt(iKey) - 48));
  131. if(strDate.length >= 6 && (iMonth <1 || iMonth > 12)){
  132. window.event.keyCode = 0;
  133. return;
  134. }
  135. }
  136. } // end if("/")
  137. else if( strDate.indexOf("-") > 0 && strDate.indexOf("-") != strDate.lastIndexOf("-")){ //正输入日期
  138. if(iKey>=48 && iKey<=57){
  139. var iPos = strDate.lastIndexOf("-");
  140. if(strDate.length - iPos > 2){
  141. window.event.keyCode = 0;
  142. return;
  143. }
  144. var iDay = parseInt("" + strDate.substr(iPos+1,strDate.length-iPos-1) + (parseInt(iKey) - 48));
  145. if(iDay > 31){
  146. window.event.keyCode = 0;
  147. return;
  148. }
  149. }
  150. }
  151. else if( strDate.indexOf("/") > 0 && strDate.indexOf("/") != strDate.lastIndexOf("/")){ //正输入日期
  152. if(iKey>=48 && iKey<=57){
  153. var iPos = strDate.lastIndexOf("/");
  154. if(strDate.length - iPos > 2){
  155. window.event.keyCode = 0;
  156. return;
  157. }
  158. var iDay = parseInt("" + strDate.substr(iPos+1,strDate.length-iPos-1) + (parseInt(iKey) - 48));
  159. if(iDay > 31){
  160. window.event.keyCode = 0;
  161. return;
  162. }
  163. }
  164. }
  165. }
  166. if(strDate.charAt(strDate.length-1) == "-" || strDate.charAt(strDate.length-1) == "/"){
  167. if(iKey != 13 && iKey != 11 && !(iKey>=48 && iKey<=57))
  168. window.event.keyCode = 0;
  169. }
  170. if(iKey == 47 || iKey == 45){
  171. if(strDate.indexOf("-") > 0 && iKey == 47)
  172. window.event.keyCode = 0;
  173. if(strDate.indexOf("/") > 0 && iKey == 45)
  174. window.event.keyCode = 0;
  175. }
  176. } // end "D"
  177. }



  1. /*自适应大小*/
  2. function DrawImage(ImgD,_width,_height){
  3. if(!_width) _width=120;
  4. if(!_height) _height=120;
  5. var flag=false;
  6. var image=new Image();
  7. image.src=ImgD.src;
  8. if(image.width>0&&image.height>0){
  9. flag=true;
  10. if(image.width/image.height>=_width/_height){//120/120
  11. if(image.width>_width){
  12. ImgD.width=_width;
  13. ImgD.height=(image.height*_width)/image.width;
  14. }else{
  15. ImgD.width=image.width;
  16. ImgD.height=image.height;
  17. }
  18. ImgD.alt=image.width+"X"+image.height;
  19. }
  20. else{
  21. if(image.height>_height){
  22. ImgD.height=_height;
  23. ImgD.width=(image.width*_height)/image.height;
  24. }else{
  25. ImgD.width=image.width;
  26. ImgD.height=image.height;
  27. }
  28. ImgD.alt=image.width+"X"+image.height;
  29. }
  30. }
  31. }
  32. /*Cookie*/
  33. function setCookie(name,value)
  34. {
  35. var Days = 365;
  36. var exp = new Date(); //new Date("December 31, 9998");
  37. exp.setTime(exp.getTime() + Days*24*60*60);
  38. document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
  39. }
  40. function getCookie(name)
  41. {
  42. var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  43. if(arr=document.cookie.match(reg))
  44. return unescape(arr[2]);
  45. else
  46. return null;
  47. }
  48. function delCookie(name)
  49. {
  50. var exp = new Date();
  51. exp.setTime(exp.getTime() - 1);
  52. var cval=getCookie(name);
  53. if(cval!=null)
  54. document.cookie= name + "="+cval+";expires="+exp.toGMTString();
  55. }
  56. /*验证数字*/
  57. function isNumber(e){
  58. var number = "1234567890";
  59. for(var i=0; i<e.length; i++){
  60. if (number.indexOf(e.charAt(i))<0) {
  61. return false;
  62. }
  63. }
  64. return true;
  65. }
  66. /*验证数字*/
  67. function isAllDigits(argvalue) {
  68. argvalue = argvalue.toString();
  69. var validChars = "0123456789";
  70. var startFrom = 0;
  71. if (argvalue.substring(0, 2) == "0x") {
  72. validChars = "0123456789abcdefABCDEF";
  73. startFrom = 2;
  74. } else if (argvalue.charAt(0) == "0") {
  75. validChars = "01234567";
  76. startFrom = 1;
  77. } else if (argvalue.charAt(0) == "-") {
  78. startFrom = 1;
  79. }
  80. for (var n = startFrom; n < argvalue.length; n++) {
  81. if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
  82. }
  83. return true;
  84. }
  85. /*检查Email是否合法*/
  86. function isEmail(s){
  87. if (s.length<7||s.length > 50){
  88. return false;
  89. }
  90. var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$"
  91. var re = new RegExp(regu);
  92. if (s.search(re) != -1) {
  93. return true;
  94. } else {
  95. return false;
  96. }
  97. }
  98. /*检查字符串是否为Null*/
  99. function isNull(s){
  100. if (s == null || s.length <= 0 || s.trim() == ""){
  101. return true;
  102. }
  103. return false;
  104. }
  105. /*检查字符串是否为空*/
  106. function isEmpty(s){
  107. if (s == null || s.length <= 0 || s.trim() == ""){
  108. return true;
  109. }
  110. return false;
  111. }

  1. /*检查日期是否合法*/
  2. function isValidDate(day, month, year) {
  3. if (month < 1 || month > 12) {
  4. return false;
  5. }
  6. if (day < 1 || day > 31) {
  7. return false;
  8. }
  9. if ((month == 4 || month == 6 || month == 9 || month == 11) &&
  10. (day == 31)) {
  11. return false;
  12. }
  13. if (month == 2) {
  14. var leap = (year % 4 == 0 &&
  15. (year % 100 != 0 || year % 400 == 0));
  16. if (day>29 || (day == 29 && !leap)) {
  17. return false;
  18. }
  19. }
  20. return true;
  21. }
  22. /*获得Radio的值*/
  23. function getRadioValue(name){
  24. var radios = document.getElementsByName(name);
  25. var i;
  26. if (null == radios.length){
  27. if(radios.checked) {
  28. return radios.value;
  29. }
  30. }
  31. for(i = 0; i < radios.length; i++){
  32. if(radios[i].checked){
  33. return radios[i].value;
  34. }
  35. }
  36. return 0;
  37. }
  38. /*设置Radio的值*/
  39. function setRadioValue(name,value){
  40. var radios = document.getElementsByName(name);
  41. var i;
  42. if (null == radios.length){
  43. if(radios.checked) {
  44. radios.checked = "checked";
  45. }
  46. }
  47. for(i=0;i<radios.length;i++){
  48. if(value == radios[i].value){
  49. radios[i].checked = "checked";
  50. }
  51. }
  52. return 0;
  53. }
  54. /*获得CheckBox的值,多个为数组*/
  55. function getCheckBoxValues(name){
  56. var values = new Array();
  57. var cbs = document.getElementsByName(name);
  58. var i;
  59. if (null == cbs) return values;
  60. if (null == cbs.length){
  61. if(cbs.checked) {
  62. values[values.length] = cbs.value;
  63. }
  64. return values;
  65. }
  66. var count = 0 ;
  67. for(i = 0; i<cbs.length; i++){
  68. if(cbs[i].checked){
  69. values[values.length] = cbs[i].value;
  70. }
  71. }
  72. return values;
  73. }
  74. /*设置CheckBox的值*/
  75. function setCheckBoxValue(name,value){
  76. var cbs = document.getElementsByName(name);
  77. var i;
  78. if (null == cbs) return 0 ;
  79. if (null == cbs.length){
  80. cbs.checked = value;
  81. return 0;
  82. }
  83. for(i=0;i<cbs.length;i++){
  84. cbs[i].checked = value;
  85. }
  86. return 0;
  87. }
  88. /*设置CheckBox选中状态*/
  89. function setCheckBoxs(name,value){
  90. var cbs = document.getElementsByName(name);
  91. var i;
  92. if (null == cbs) return 0 ;
  93. if (null == cbs.length){
  94. cbs.checked = true;
  95. return 0;
  96. }
  97. for(i=0;i<cbs.length;i++){
  98. if(cbs[i].value == value){
  99. cbs[i].checked = true;
  100. }
  101. }
  102. return 0;
  103. }
  104. function htmlEncode(text) {
  105. return text.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
  106. }

  1. var Request = new Object();
  2. Request.send = function(url, method, callback, data, urlencoded) {
  3. var req;
  4. if (window.XMLHttpRequest) {
  5. req = new XMLHttpRequest();
  6. if (req.overrideMimeType) {
  7. req.overrideMimeType('text/xml');
  8. }
  9. } else if (window.ActiveXObject) {
  10. req = new ActiveXObject("Microsoft.XMLHTTP");
  11. }
  12. req.onreadystatechange = function() {
  13. if (req.readyState == 4) {
  14. if (req.status < 400) {
  15. (method=="POST") ? callback(req) : callback(req,data);
  16. } else {
  17. }
  18. }
  19. }
  20. if (method=="POST") {
  21. req.open("POST", url, true);
  22. if (urlencoded) req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23. req.send(data);
  24. } else {
  25. req.open("GET", url, true);
  26. req.send(null);
  27. }
  28. // return req;
  29. }
  30. Request.sendRawPOST = function(url, data, callback) {
  31. Request.send(url, "POST", callback, data, false);
  32. }
  33. Request.sendPOST = function(url, data, callback) {
  34. Request.send(url, "POST", callback, data, true);
  35. }
  36. Request.sendGET = function(url,callback) {
  37. Request.send(url, "GET", callback, null, null);
  38. }
  39. /*分析status文件的内容*/
  40. function parseResponseStatus(documentElement){
  41. var dataobj = new Object();
  42. //parse status
  43. var status = documentElement.getElementsByTagName("status");
  44. if(status && status.length > 0){
  45. if(status[0].firstChild){
  46. dataobj.status = status[0].firstChild.nodeValue;
  47. }
  48. else{
  49. dataobj.status = "";
  50. }
  51. }
  52. return dataobj;
  53. }
  54. //提交form,把得到的数据放在指定的ID上.
  55. function ajaxFormRequest(datastr) {
  56. eval("var obj = "+datastr+";");
  57. if (obj.id == null)
  58. obj.id = "输入自定义id";
  59. disableBtn();
  60. dojo.io.bind({
  61. url: parseUrl(obj.url),
  62. useCache: false,
  63. preventCache: false,
  64. encoding:'UTF-8',
  65. load: function(type, data, evt) {
  66. $E(obj.id).innerHTML = data;
  67. enableBtn();
  68. },
  69. error: function(type, error) { alert("error");},
  70. mimetype: "text/plain",
  71. formNode: $E(obj.form)
  72. });
  73. }
  74. //提交form,执行load方法
  75. function ajaxRequestLoad(datastr) {
  76. eval("var obj = "+datastr+";");
  77. if (obj.id == null)
  78. obj.id = "输入自定义id";
  79. disableBtn();
  80. dojo.io.bind({
  81. url: parseUrl(obj.url),
  82. useCache: false,
  83. preventCache: false,
  84. encoding:'UTF-8',
  85. load: obj.load,
  86. error: function(type, error) { alert("error");},
  87. mimetype: "text/plain",
  88. formNode: $E(obj.form)
  89. });
  90. }


  1. /*金额标签转换函数*/
  2. function money_convert(name){
  3. var formatName = name + "_format";
  4. var strValue = document.getElementById(formatName).value;
  5. strValue=strValue.replace(",","");
  6. var regex = /^(0(/./d{0,2})?|([1-9]+[0]*)+(/./d{0,2})?)$/;
  7. if(!regex.test(strValue)){
  8. //alert("金额格式不正确!");
  9. document.getElementById(name).value=0;
  10. document.getElementById(formatName).value=0;
  11. }else{
  12. strValue = Math.round(parseFloat(strValue)*1000+0.001);
  13. document.getElementById(name).value=strValue;
  14. }
  15. }
  16. /*金额标签转换函数
  17. * 获得焦点时,去掉金额中的','符号
  18. */
  19. function prepare(obj){
  20. var strValue = obj.value;
  21. strValue=strValue.replaceAll(",","");
  22. obj.value = strValue;
  23. obj.select();
  24. }
  25. String.prototype.replaceAll = function(s1,s2){
  26. return this.replace(new RegExp(s1,"gm"),s2);
  27. }
  28. /*日期标签转换函数*/
  29. function setDate(name){
  30. var formatName = "format_" + name;
  31. var tempDate = document.getElementById(name).value;
  32. var validateDate = dojo.widget.byId(formatName).inputNode.value;
  33. var regex = /^[1-9]{1}/d{3}-/d{1,2}-/d{1,2}$/;
  34. if(regex.test(validateDate)){
  35. var dateString = validateDate.split("-");
  36. var year = dateString[0];
  37. var month = dateString[1];
  38. var day = dateString[2];
  39. if(testMonth(month)&&testDay(year,month,day)){
  40. document.getElementById(name).value=validateDate;
  41. return;
  42. }
  43. }
  44. if(validateDate==""){
  45. tempDate="";
  46. }
  47. dojo.widget.byId(formatName).inputNode.value=tempDate;
  48. document.getElementById(name).value=tempDate;
  49. }
  50. function testMonth(month){
  51. if (month < 1 || month > 12)
  52. {
  53. alert("月份应该为1到12的整数");
  54. return false;
  55. }
  56. return true;
  57. }
  58. function testDay(year,month,day){
  59. if (day < 1 || day > 31)
  60. {
  61. alert("每个月的天数应该为1到31的整数");
  62. return false;
  63. }
  64. if ((month==4 || month==6 || month==9 || month==11) && day==31)
  65. {
  66. alert("该月不存在31号");
  67. return false;
  68. }
  69. if (month==2)
  70. {
  71. var isleap=(year % 4==0 && (year % 100 !=0 || year % 400==0));
  72. if (day>29)
  73. {
  74. alert("2月最多有29天");
  75. return false;
  76. }
  77. if ((day==29) && (!isleap))
  78. {
  79. alert("闰年2月才有29天");
  80. return false;
  81. }
  82. }
  83. return true;
  84. }
  85. //比较两个日期是否有效(第一个日期不能在大于第二个日期);第一个日期可以为空,当为空时不进行验证
  86. function compareTwoDate(startDate,endDate,s){
  87. var a=startDate;
  88. var b=endDate;
  89. if(startDate==""){
  90. return true;
  91. }
  92. if(((Number(a.substring(0,4))-Number(b.substring(0,4)))*356+
  93. (Number(a.substring(5,7))-Number(b.substring(5,7)))*31+
  94. (Number(a.substring(8,10))-Number(b.substring(8,10))))>0){
  95. alert(s);
  96. //startDate.focus();
  97. return false;
  98. }
  99. return true;
  100. }
  101. //比较两个日期时间是否有效(第一个日期时间不能在大于第二个日期时间);第一个日期时间可以为空,当为空时不进行验证
  102. function compareTwoDateTime(startDate,endDate,startTime,endTime,s){
  103. var a=startDate;
  104. var b=endDate;
  105. var at = startTime;
  106. var bt = endTime;
  107. if(startDate==""){
  108. return true;
  109. }
  110. if(((Number(a.substring(0,4))-Number(b.substring(0,4)))*356*24*3600+
  111. (Number(a.substring(5,7))-Number(b.substring(5,7)))*31*24*3600+
  112. (Number(a.substring(8,10))-Number(b.substring(8,10)))*24*3600+
  113. (Number(at.substring(0,2))-Number(bt.substring(0,2)))*3600+
  114. (Number(at.substring(3,5))-Number(bt.substring(3,5)))*60+
  115. (Number(at.substring(6))-Number(bt.substring(6)))>0)){
  116. alert(s);
  117. return false;
  118. //startDate.focus();
  119. }
  120. return true;
  121. }
  122. //验证时间是否合法.
  123. function testTime(time){
  124. var regex = /^[0-2]{1}[0-9]{1}:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/;
  125. if(!regex.test(time)){
  126. alert("您输入的时间格式不正确!");
  127. return false;
  128. }
  129. var hour = time.substring(0,2);
  130. var minute = time.substring(3,5);
  131. var second = time.substring(6);
  132. if(hour>23 || hour <0){
  133. alert("小时的值应该在0-23之间!");
  134. return false;
  135. }
  136. if(minute > 60 ||minute < 0){
  137. alert("分钟的值应该在0-59之间!");
  138. return false;
  139. }
  140. if(second > 60 ||second < 0){
  141. alert("秒钟的值应该在0-59之间!");
  142. return false;
  143. }
  144. return true;
  145. }
  146. String.prototype.trim=function(){
  147. return this.replace(/(^/s*)|(/s*$)/g, "");
  148. }
  149. function sendmoneycheck(path,orderSeqid) {
  150. var password = document.getElementById('password').value;
  151. if(document.getElementById('password').value==null || document.getElementById('password').value=='') {
  152. alert('取款密码必须输入');
  153. } else {
  154. var url = path+'/sendmoney/managerecconfirmsendmoney.htm?orderSeqid='+orderSeqid+'&passwd='+document.getElementById('password').value;
  155. ajaxFormRequest('{url:"'+url+'",id:"paginationResult"}');
  156. $E('buttonconfirm').disabled=true;
  157. }
  158. }
  159. function isUrlValidate(url){
  160. var regx = /^(/s)*(http(s)?:)?([/w-]+/.)+[/w-]+(:(/d{1,4}))?(//[/w-.//?%&=]*)?(/s)*$/;
  161. return regx.test(url);
  162. }
  163. function isDateValidate(strDate){
  164. var regx = /^([1-2]/d{3})[//|/-](0?[1-9]|10|11|12)[//|/-]([1-2]?[0-9]|0[1-9]|30|31)$/;
  165. return regx.test(strDate);
  166. }
  167. function isEmailValidate(email){
  168. var regx = /^(/s)*([/w]+([-_.][/w]+)*@[/w]+([.][/w]+)*/.[/w]+([.][/w]+)*)(/s)*$/;
  169. return regx.test(email);
  170. }
  171. function isPhoneValidate(tel){
  172. var regx = /^(/s)*((1[35]/d{9})|((0/d{2,3}/-){1}[1-9]{1}/d{6,7}(/-/d{1,4})?))(/s)*$/;
  173. return regx.test(tel);
  174. }
  175. function isMobileValidate(tel){
  176. var regx = /^(/s)*(1[35]/d{9})(/s)*$/;
  177. return regx.test(tel);
  178. }
  179. function dateCompare(date1, date2){
  180. date1 = date1.replace(/-/g, "/");
  181. date2 = date2.replace(/-/g, "/");
  182. try{
  183. return Date.parse(date1) - Date.parse(date2);
  184. }
  185. catch(e){
  186. return 0;
  187. }
  188. }
  189. function respond(obj){
  190. if(window.event.keyCode==13){
  191. obj.onblur();
  192. }
  193. }
  194. function parseUrl(url){
  195. var uniqueKey = new Date();
  196. if(url != null && url.indexOf("?") > 0){
  197. url += "&uniqueKey=" + uniqueKey;
  198. }
  199. else{
  200. url += "?uniqueKey=" + uniqueKey;
  201. }
  202. return url;
  203. }
  204. function disableBtn(){
  205. var oBtns = document.getElementsByName("BTN_QRY");
  206. if(oBtns != null && oBtns.length > 0){
  207. for(var i=0; i<oBtns.length; i++){
  208. oBtns[i].disabled = true;
  209. }
  210. }
  211. }
  212. function enableBtn(){
  213. var oBtns = document.getElementsByName("BTN_QRY");
  214. if(oBtns != null && oBtns.length > 0){
  215. for(var i=0; i<oBtns.length; i++){
  216. oBtns[i].disabled = false;
  217. }
  218. }
  219. }
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值