本文介绍了我如何通过java脚本在HTML中按位置编辑/替换脚本标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 / * <![CDATA [* / 如果( typeof 日期。现在=== ' undefined'){日期 .now = function (){ return + new 日期(); $( document )。ready( function (){ deleteCookie ( qbjpactive); $( #refresh)。点击( function (){ $( #cimage)。attr(' src',' captchaImage?' + Math .random()); }); var msg = ; if (msg!= null && msg!= ){ RichFaces。$(' loginerrorpanel')。show(); setFocus($( #loginerrorpanelok))} $( #otpId)。change(功能(){ if ($( #otpId)。is( :checked)){ $( tr.captchacls)。hide() $( div.captchacls)。hide()} else { $( tr.captchacls)。show() $( div.captchacls)。show( )} }); $( #usernameId)。focus(); window .mcc = {}; window .mcc.c = true ; window .mcc.lbp = false ; window .mcc.j = 465 ; window .mcc.k = 720 window .mcc.t = parseInt ( 746 ); window .mcc.l = parseInt ( 1462776962381 ); window .mcc.cd = + Date.now(); window .mcc.d = window .mcc.l - 窗口 .mcc.cd; 尝试 { window .mcc.o = parseInt ( 6000 ); } catch (错误){} if ( window .mcc.j!= null && window .mcc.k!= null ){ window .mcc.j = parseInt ( window .mcc.j); window .mcc.k = parseInt (窗口 .mcc.k); if ( window .mcc.t< window .mcc.j || window .mcc.t> = window 。 mcc.k){ window .mcc.c = false ; } } $( #cimage)。 on( load, function ( ){ window .mcc.clt = + Date.now()+ window .mcc .d; }); $( #loginbutton)。click( function (event){ window .mcc.lbp = true ; if (!($。trim($( .loginUserId)。val())== | | $ .trim($( 。loginPassword)。val())== ||( document .getElementById( otpId)。checked == false & ;& $ .trim($( 。loginCaptcha)。val())== ))){ if ( window .mcc。 c&& window .mcc.o!= null ){ window .mcc.waitT =(+ Date.now()+ window .mcc.d)-window.mcc.clt; if ( window .mcc.o> 0 && window .mcc.waitT< window .mcc.o ){ RichFaces。$(' waitOnLogINPopup')。show(); setTimeout( function (){ RichFaces。$(' waitOnLogINPopup')。hide(); $(' #loginbuttonW')。click(); },( window .mcc.o - 窗口 .mcc.waitT)); return false ; } } $(' #loginbuttonW')。点击(); return false ; } }); }); function validateloginDetail(){ return 窗口 .mcc.lbp; } function validateloginDetails(){ var retVal = true ; $( #loginsErr)。html( ); if ($ .trim($( .loginUserId)。val())== ){ alert( 输入用户ID); setFocus($( .loginUserId)); return false ; } if ($ .trim($( .loginPassword)。val())== ){ alert( 输入密码); setFocus($( 。loginPassword)); return false ; } if ( document .getElementById( otpId)。checked == false && $。 trim($( 。loginCaptcha)。val())== ){ alert( 输入文本,如验证码); setFocus($( otpId)); return false ; } return retVal; } / * * / 我的尝试: i repost 解决方案 ( document )。ready( function ( ){ deleteCookie( qbjpactive); ( #refresh)。click( function (){ ( #cimage)。attr(' src',' captchaImage?' + Math .random()); }); var msg = ; if (msg!= null && msg!= ){ RichFaces。 /*<![CDATA[*/ if (typeof Date.now === 'undefined') { Date.now = function () { return +new Date(); } } $(document).ready(function(){ deleteCookie("qbjpactive");$("#refresh").click(function(){$("#cimage").attr('src','captchaImage?' + Math.random());});var msg = "";if(msg != null && msg != ""){RichFaces.$('loginerrorpanel').show();setFocus($("#loginerrorpanelok"))}$("#otpId").change(function () {if($("#otpId").is(":checked")){$("tr.captchacls").hide()$("div.captchacls").hide()}else{$("tr.captchacls").show()$("div.captchacls").show()}});$("#usernameId").focus();window.mcc = {};window.mcc.c = true;window.mcc.lbp = false;window.mcc.j= 465;window.mcc.k= 720window.mcc.t = parseInt(746);window.mcc.l = parseInt(1462776962381);window.mcc.cd = +Date.now();window.mcc.d = window.mcc.l - window.mcc.cd; try{window.mcc.o = parseInt(6000);}catch(err){}if(window.mcc.j != null && window.mcc.k !=null){window.mcc.j = parseInt(window.mcc.j);window.mcc.k = parseInt(window.mcc.k);if(window.mcc.t < window.mcc.j || window.mcc.t >= window.mcc.k){window.mcc.c = false;}}$("#cimage").on("load",function(){window.mcc.clt = +Date.now() + window.mcc.d;});$("#loginbutton").click(function(event){window.mcc.lbp = true;if(!($.trim($(".loginUserId").val()) == "" || $.trim($(".loginPassword").val()) == "" || (document.getElementById("otpId").checked==false && $.trim($(".loginCaptcha").val()) == "") )){if(window.mcc.c && window.mcc.o != null){window.mcc.waitT = (+Date.now() + window.mcc.d)-window.mcc.clt;if(window.mcc.o > 0 && window.mcc.waitT < window.mcc.o){RichFaces.$('waitOnLogINPopup').show();setTimeout(function () {RichFaces.$('waitOnLogINPopup').hide();$('#loginbuttonW').click();}, (window.mcc.o - window.mcc.waitT));return false;}}$('#loginbuttonW').click();return false;}});}); function validateloginDetail(){ return window.mcc.lbp; } function validateloginDetails(){ var retVal = true; $("#loginsErr").html(""); if($.trim($(".loginUserId").val()) == ""){alert("Enter User ID");setFocus($(".loginUserId")); return false; } if($.trim($(".loginPassword").val()) == ""){ alert("Enter Password"); setFocus($(".loginPassword")); return false; } if(document.getElementById("otpId").checked==false && $.trim($(".loginCaptcha").val()) == ""){ alert("Enter the text as in captcha"); setFocus($("otpId")); return false; } return retVal; } /**/What I have tried:i repost 解决方案 (document).ready(function(){ deleteCookie("qbjpactive");("#refresh").click(function(){("#cimage").attr('src','captchaImage?' + Math.random());});var msg = "";if(msg != null && msg != ""){RichFaces. 这篇关于我如何通过java脚本在HTML中按位置编辑/替换脚本标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-20 07:18