+ -
当前位置:首页 → 问答吧 → 懂JS的帮我看看,为什么总会被会注册空白或者乱码信息

懂JS的帮我看看,为什么总会被会注册空白或者乱码信息

时间:2010-09-09

来源:互联网

<SCRIPT language=JavaScript type=text/JavaScript>  
function  openwin(page){  
window.open(page,'_blank','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,scrolling=no,resizable=no,width=560,height=350,top=0,left=0');  
}
</SCRIPT>
<SCRIPT language=JavaScript>   
function   getrandom(len)   
{   
var   seed   =   new   Array(   
'0123456789',   
'0123456789',   
'0123456789'   
);   
var   idx,i;   
var   result   =   'vip';   
for   (i=0;   i<len;   i++)   
{   
idx   =   Math.floor(Math.random()*3);   
result   +=   seed[idx].substr(Math.floor(Math.random()*(seed[idx].length)),   1);   
}   

return   result;
}   
</SCRIPT>
<SCRIPT language=javascript id=Infragistics>
<!--
function getRandPw()
{
    var PwdShow = document.getElementById("lblPwShow";
    var rand_num =1;
    var randstr = "";
    var randResult ="";
    var rand_style = 0;
    var pwScore = 0;
   
    while (pwScore <= 32)
    {
        randResult = "";
        for (var i=0; i < 8; i++)
        {
            rand_style = Math.floor(9* Math.random()) % 2;
            if (rand_style == 1)
            {
                //Gen a-e
                rand_num = Math.floor(5 * Math.random());
                randstr = String.fromCharCode(rand_num + 65);
                randResult += randstr;
            }
            else
            {
                //Gen 0-9
                rand_num = Math.floor(9 * Math.random());
                randstr = String.fromCharCode(rand_num + 4;
                randResult += randstr;
            }
        }
        pwScore = doGetPassScorejs(randResult);
    }
   
    PwdShow.value = randResult;
}
function doGetPassScorejs( _pass )
{
     var _score = 0;
     var _dup = 0;
     var _run = 0;
     var _hasSpecial    = false;
     var _hasNumber     = false;
     var _hasLowerCase  = false;
     var _hasUpperCase  = false;
     
     //check duplicated letter: infoPassDupLetter
     for( var i = 0; i < _pass.length; i++ ){
      var _tmpArr = _pass.split(_pass.substr(i,1));
      if( _tmpArr.length > 4 ){
       _dup = 0;
       for( var j = 0; j < _tmpArr.length; j++ ){
        if( _tmpArr[j].length == 0 && j > 0 )_dup++;
       }
       if( _dup >= 3 ){
        _score = 0;
        break;
       }
      }else{
       if( _pass.charCodeAt(i) >= 33 && _pass.charCodeAt(i) <= 47 ||
        _pass.charCodeAt(i) >= 58 && _pass.charCodeAt(i) <= 64 ||
        _pass.charCodeAt(i) >= 91 && _pass.charCodeAt(i) <= 96 ||
        _pass.charCodeAt(i) >= 123 && _pass.charCodeAt(i) <= 126 ){
        // special characters
        _score += 10;
        _hasSpecial = true;
       }else{
        if( _pass.charCodeAt(i) >= 48 && _pass.charCodeAt(i) <= 57 ){
         // 0~9
         _score += 4;
         _hasNumber = true;
        }else{
         if( _pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 ||
          _pass.charCodeAt(i) >= 97 && _pass.charCodeAt(i) <= 122 ){
          // A~Z || a~z
          _score += 7;
          if( _pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 )_hasUpperCase = true;
          else _hasLowerCase = true;
         }else{
          // no other special characters allowed
          _score = 0;
          break;
         }
        }
       }
      }
     }
     if( _score > 0 ){
      if( _hasSpecial && _hasNumber || _hasSpecial && _hasUpperCase || _hasSpecial && _hasLowerCase )_score += 10;
      if( _hasNumber && _hasUpperCase || _hasNumber && _hasLowerCase )_score += 8;
      if( _hasUpperCase && _hasLowerCase )_score += 8;
     }
     // check running characters
     if( _pass.length >= 4 ){
      for( var i = 0; i < _pass.length - 3; i++ ){
       // check only 0~9 && A~Z && a~z
       if( _pass.charCodeAt(i) >= 48 && _pass.charCodeAt(i) <= 57 ||
        _pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 ||
        _pass.charCodeAt(i) >= 97 && _pass.charCodeAt(i) <= 122 ){
        _run = 0;
        if( Math.abs( _pass.charCodeAt(i) - _pass.charCodeAt(i+1)) == 1 &&
         Math.abs( _pass.charCodeAt(i+1) - _pass.charCodeAt(i+2)) == 1 &&
         Math.abs( _pass.charCodeAt(i+2) - _pass.charCodeAt(i+3)) == 1 ){
         _score = 0;
         break;
        }
       }
      }
     }
     return (( _score > 100 )?100_score < 0 )?0:_score));
}
-->
</SCRIPT>
<META content="MSHTML 6.00.3790.630" name=GENERATOR></HEAD>
<BODY oncontextmenu=window.event.returnValue=false  onselectstart=event.returnValue=false ondragstart=window.event.returnValue=false  style="BACKGROUND: none transparent scroll repeat 0% 0%"  onload=document.all.txt.innerHTML=getrandom(5)  onsource="event.returnValue=false">
<DIV align=left>
<TABLE cellSpacing=0 cellPadding=0 width=685 border=0>
  <TR>
    <TD vAlign=center width=685>
      <TABLE cellSpacing=0 cellPadding=0 width=733 border=0>
        <TR>
          <TD vAlign=top width=733>
            < class=STYLE2 align=center>&nbsp;</P>
            < class=STYLE2
            align=left>&nbsp;</P>
            < class="STYLE2"><STRONG>(<span class="STYLE44">*</span></STRONG><span class="STYLE50">有標記的欄目必須填妥</span></P>
           
            <FORM id=form1 name=form1
            onsubmit="javascript:return WebForm_OnSubmit();" action=admin/addUser.asp
            method=post target=_self><INPUT id=__EVENTTARGET type=hidden              name=__EVENTTARGET> <INPUT id=__EVENTARGUMENT type=hidden              name=__EVENTARGUMENT> <INPUT id=__VIEWSTATE type=hidden              value=/wEPDwULLTEyNzYwODEyMTAPFgIeCENhbGxQYWdlBQtoZWFkZXIuYXNweBYCAgMPZBYcZg8PFgIeBFRleHQFDOS/ruaUueWvhueivGRkAgEPFgIeB1Zpc2libGVoFgJmD2QWAgIBDw8WAh8BBQznmbvlhaXluLPomZ9kZAICDw8WAh8BBUQq5a+G56K85b+F6aCI5L2/55SoKDAtOSxBLUUp6ICM5LiU6Iez5bCR54K6IDgg5oiW6Iez5aSaIDEyIOWAi+Wtl+WFg2RkAgMPDxYCHwEFDOeZu+WFpeWvhueivGRkAgUPDxYCHgxFcnJvck1lc3NhZ2UFDOiri+W/hei8uOWFpWRkAgcPDxYCHwMFEuWvhueivOeiuuiqjeS4jeespmRkAggPDxYCHwMFQ+WvhueivOW/hemgiOS9v+eUqCgwLTksQS1FKeiAjOS4lOiHs+WwkeeCuiA4IOaIluiHs+WkmiAxMiDlgIvlrZflhYNkZAIJDw8WAh8BBRvpmqjmqZ/mlrDlr4bnorzntYTlkIjmj5DnpLpkZAILDw8WAh8BBQznorroqo3lr4bnorxkZAINDw8WAh8DBQzoq4vlv4XovLjlhaVkZAIPDw8WAh8DBUPlr4bnorzlv4XpoIjkvb/nlKgoMC05LEEtRSnogIzkuJToh7PlsJHngrogOCDmiJboh7PlpJogMTIg5YCL5a2X5YWDZGQCEA8PFgQfAQUH5o+QIOS6pB4NT25DbGllbnRDbGlja2VkZAIRDw8WBB8BBQblj5bmtogfBGVkZAISDw8WAh8BBRLph43oqK3lr4bnorzlpLHmlZdkZGQk1ZhRvTqfQl+QOWpTlJ74Ygtxdg==              name=__VIEWSTATE>
            <SCRIPT language=javascript>
<!--
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</SCRIPT>
            <SCRIPT src="" type=text/javascript></SCRIPT>
            <SCRIPT src="" type=text/javascript></SCRIPT>
            <SCRIPT language=javascript>
<!--
function WebForm_OnSubmit()
{
document.form1.user_na_id.value=document.all.txt.innerHTML
if (document.form1.wPwd1a.value==0)
{
alert("請輸入密碼!"
document.form1.wPwd1a.focus()
document.form1.wPwd1a.select()
return false
}
field=document.form1.wPwd1a.value
var text = new String(field);
re = /^[a-zA-Z0-9]+\d*$/;
re1 = /[0-9]/g;
re2= /[a-zA-Z]/g;
if(!re.test(text) || !re1.test(text) || !re2.test(text))
{
alert('密碼必須使用(0-9,A-E)而且至少為 8 或至多 12 個字元!');
document.form1.wPwd1a.focus()
document.form1.wPwd1a.select()
return false;
}
       
if(document.form1.wPwd2a.value==0){
alert("請輸入確認密碼!";
document.form1.wPwd2a.focus();
return false;
}       
if(document.form1.username.value==0){
alert("请输入中文姓名!";
document.form1.username.focus();
return false;
}
if(document.form1.user_cell.value==0){
alert("請輸入手機號碼!";
document.form1.user_cell.focus();
return false;
}
if (isNaN(document.form1.user_cell.value)){
alert("請正確輸入手機號碼!";
document.form1.user_cell.focus();
return false;
}
if(document.form1.moneytype.value=="6"&&document.form1.bankname.value==""{
alert("請選擇銀行名稱!";
document.form1.bankname.focus();
return false;
}
if(document.form1.moneytype.value=="6"&&document.form1.bankno.value==""{
alert("請輸入銀行戶口號碼!";
document.form1.bankno.focus();
return false;
}
if(document.form1.moneytype.value=="6"&&document.form1.rebankno.value==""){
alert("請輸入確認銀行戶口號碼!");
document.form1.rebankno.focus();
return false;
}
if(document.form1.moneytype.value=="6"&&document.form1.bankarea.value==""){
alert("請輸入銀行地區!");
document.form1.bankarea.focus();
return false;
}
if(document.form1.moneytype.value=="7"&&document.form1.bankname.value==""){
alert("請選擇銀行名稱!");
document.form1.bankname.focus();
return false;
}
if(document.form1.moneytype.value=="7"&&document.form1.bankno.value==""){
alert("請輸入銀行戶口號碼!");
document.form1.bankno.focus();
return false;
}
if(document.form1.moneytype.value=="7"&&document.form1.rebankno.value==""){
alert("請輸入確認銀行戶口號碼!");
document.form1.rebankno.focus();
return false;
}
if(document.form1.moneytype.value=="7"&&document.form1.bankarea.value==""){
alert("請輸入銀行地區!");
document.form1.bankarea.focus();
return false;
}
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
// -->
</SCRIPT>
            
            <TABLE width=733 border=0>
              <TBODY>
              <TR>
                <TD width="100" height="24" nowrap class=STYLE2><div align="center"><span class="STYLE50"><U>賬戶資料</U></span> </div></TD>
                <TD class=STYLE2></TD>
              </TR>
              <TR>
                <TD width=100 height="25" nowrap class=STYLE2><div align="center"><span class="STYLE44">*</span><span class="STYLE50">用戶名稱:</span><STRONG>&nbsp;</STRONG></div></TD>
                <TD width=658 class=STYLE2><SPAN id=txt></SPAN>
                  <INPUT name=user_na_id                    type=hidden id="user_na_id"> <INPUT onclick=document.all.txt.innerHTML=getrandom(5) type=button value=再選一次 name=button></TD></TR>
              <TR>
                <TD width="100" valign="top" nowrap class=STYLE2><div align="center"><span class="STYLE44">*</span><span class="STYLE52">密碼:</span></div></TD>
                <TD class=STYLE2>
                  <>
                    <input name=user_pass type=password id=wPwd1a style="WIDTH: 200px" size="12" maxlength=12                          readonly>
                    <span class="STYLE37">密碼必須使用(0-9,A-E)而且至少為 8 或至多 12 個字元
                    
                    </span>                  <SPAN class=STYLE31>
                  <TABLE width=658>
                    <TBODY>
                      <TR>
                        <TD width=650 height="122"><SCRIPT language=javascript><!--//
function doClickKeypad( pTargetID, pHiddenID, pKeyValue ){
var pwdObj = document.getElementById( pTargetID );
var hideObj = document.getElementById( pHiddenID );
pwdObj.value = pwdObj.value + pKeyValue.toLowerCase();
hideObj.value = pwdObj.value;
}
function doBackSpace( pTargetID, pHiddenID ){
var pwdObj = document.getElementById( pTargetID );
var hideObj = document.getElementById( pHiddenID );
pwdObj.value = pwdObj.value.substr(0, pwdObj.value.length - 1);
hideObj.value = pwdObj.value;
}
function doResetPasswd( pTargetID, pHiddenID ){
var pwdObj = document.getElementById( pTargetID );
var hideObj = document.getElementById( pHiddenID );
pwdObj.value = "";
hideObj.value = "";
}
function doGetPassScore( _pass ){
var _score = 0;
var _dup = 0;
var _run = 0;
var _hasSpecial    = false;
var _hasNumber     = false;
var _hasLowerCase  = false;
var _hasUpperCase  = false;
//check duplicated letter: infoPassDupLetter
for( var i = 0; i < _pass.length; i++ ){
var _tmpArr = _pass.split(_pass.substr(i,1));
if( _tmpArr.length > 4 ){
_dup = 0;
for( var j = 0; j < _tmpArr.length; j++ ){
if( _tmpArr[j].length == 0 && j > 0 )_dup++;
}
if( _dup >= 3 ){
_score = 0;
alert("密碼內太多重複的字串");
break;
}
}else{
if( _pass.charCodeAt(i) >= 33 && _pass.charCodeAt(i) <= 47 ||
_pass.charCodeAt(i) >= 58 && _pass.charCodeAt(i) <= 64 ||
_pass.charCodeAt(i) >= 91 && _pass.charCodeAt(i) <= 96 ||
_pass.charCodeAt(i) >= 123 && _pass.charCodeAt(i) <= 126 ){
// special characters
_score += 10;
_hasSpecial = true;
}else{
if( _pass.charCodeAt(i) >= 48 && _pass.charCodeAt(i) <= 57 ){
// 0~9
_score += 4;
_hasNumber = true;
}else{
if( _pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 ||
_pass.charCodeAt(i) >= 97 && _pass.charCodeAt(i) <= 122 ){
// A~Z || a~z
_score += 7;
if( _pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 )_hasUpperCase = true;
else _hasLowerCase = true;
}else{
// no other special characters allowed
_score = 0;
alert("密碼不可使用空白或非英文語系的字");
break;
}
}
}
}
}
if( _score > 0 ){
if( _hasSpecial && _hasNumber || _hasSpecial && _hasUpperCase || _hasSpecial && _hasLowerCase )_score += 10;
if( _hasNumber && _hasUpperCase || _hasNumber && _hasLowerCase )_score += 8;
if( _hasUpperCase && _hasLowerCase )_score += 8;
}
// check running characters
if( _pass.length >= 4 ){
for( var i = 0; i < _pass.length - 3; i++ ){
// check only 0~9 && A~Z && a~z
if( _pass.charCodeAt(i) >= 48 && _pass.charCodeAt(i) <= 57 ||
_pass.charCodeAt(i) >= 65 && _pass.charCodeAt(i) <= 90 ||
_pass.charCodeAt(i) >= 97 && _pass.charCodeAt(i) <= 122 ){
_run = 0;
if( Math.abs( _pass.charCodeAt(i) - _pass.charCodeAt(i+1)) == 1 &&
Math.abs( _pass.charCodeAt(i+1) - _pass.charCodeAt(i+2)) == 1 &&
Math.abs( _pass.charCodeAt(i+2) - _pass.charCodeAt(i+3)) == 1 ){
_score = 0;
alert("密碼中太多順序字串");
break;
}
}
}
}
return (( _score > 100 )?100_score < 0 )?0:_score));
}
function doChkPasswd(pHiddenID, pScore){
var pwdObj = document.getElementById( pHiddenID );
var scoreObj = document.getElementById( pScore);
var _score = doGetPassScore( pwdObj.value );
if( pwdObj.length == 0 ) _score = -1;
else if( pwdObj.length < 8 ) _score = 0;
scoreObj.value = _score;
document.getElementById("divPassStrength").innerHTML = "";
if( _score == 0 ){
document.getElementById("divPassStrength").innerHTML = "未乎合要求";
document.getElementById("divPassStrength").style.color = "#FF0000";
return;   
}
if( _score <= 32 ){
document.getElementById("divPassStrength").innerHTML = "密碼保安程度低";
document.getElementById("divPassStrength").style.color = "#FF0000";
}else{
if( _score <= 45 ){
document.getElementById("divPassStrength").innerHTML = "密碼保安程度尚可";
document.getElementById("divPassStrength").style.color = "#0000FF";
}else{
document.getElementById("divPassStrength").innerHTML = "密碼保安程度高";
document.getElementById("divPassStrength").style.color = "#00FF00";
}
}
}
//-->
                  </SCRIPT>
                          
                          <TABLE width=632 border=0>
                            <TR>                            </TR>
                            <TBODY>
                              <TR>
                                <TD noWrap><INPUT id=Keypad0 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','9');doChkPasswd('wPwd1','wScore')" type=button value=9>
                                  <INPUT id=Button1 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','1');doChkPasswd('wPwd1','wScore')" type=button value=1>
                                  <INPUT id=Button2 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','6');doChkPasswd('wPwd1','wScore')" type=button value=6>
                                  <INPUT id=Button3 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','2');doChkPasswd('wPwd1','wScore')" type=button value=2>
                                  <INPUT id=Button4 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','3');doChkPasswd('wPwd1','wScore')" type=button value=3>                            </TD></TR>
                              <TR>
                                <TD noWrap><INPUT id=Button5 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','0');doChkPasswd('wPwd1','wScore')" type=button value=0>
                                  <INPUT id=Button6 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','5');doChkPasswd('wPwd1','wScore')" type=button value=5>
                                  <INPUT id=Button7 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','7');doChkPasswd('wPwd1','wScore')" type=button value=7>
                                  <INPUT id=Button8 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','8');doChkPasswd('wPwd1','wScore')" type=button value=8>
                                  <INPUT id=Button9 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','4');doChkPasswd('wPwd1','wScore')" type=button value=4>                            </TD></TR>
                              <TR>
                                <TD height="32" noWrap><INPUT id=Button10 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','A');doChkPasswd('wPwd1','wScore')" type=button value=A>
                                  <INPUT id=Button11 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','E');doChkPasswd('wPwd1','wScore')" type=button value=E>
                                  <INPUT id=Button12 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','D');doChkPasswd('wPwd1','wScore')" type=button value=D>
                                  <INPUT id=Button13 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','C');doChkPasswd('wPwd1','wScore')" type=button value=C>
                                  <INPUT id=Button14 style="FONT-SIZE: 15px; WIDTH: 30px; HEIGHT: 30px" onClick="doClickKeypad('wPwd1a','wPwd1','B');doChkPasswd('wPwd1','wScore')" type=button value=B>
                                  <input name="button2" type=button id=button style="WIDTH: 20px; HEIGHT: 20px" onClick="doBackSpace('wPwd1a','wPwd1');doChkPasswd('wPwd1','wScore')" value="<<">
                                  <input name="button3" type=button id=button2 onClick="doResetPasswd('wPwd1a','wPwd1');doChkPasswd('wPwd1','wScore')" value=重設></TD>                                      
                              </TR></TBODY>
                          </TABLE>                          
                          <SPAN id=CompareValidator1
                        style="DISPLAY: none; COLOR: red">密碼確認不符</SPAN> <SPAN
                        class=FormMessage id=pwdLength1
                        style="DISPLAY: none; COLOR: red">密碼必須使用(0-9,A-E)而且至少為 8
                            或至多 12 個字元</SPAN> </TD>
                      </TR>
                    </TBODY>
                  </TABLE>

作者: 1263761   发布时间: 2010-09-09

楼主把你的代码放在"[code]"中。要不容易出现转义了。

作者: renxiao2003   发布时间: 2010-09-09

相关阅读 更多