茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    用htc實現(xiàn)驗證模塊
    來源:易賢網(wǎng) 閱讀:937 次 日期:2016-06-15 10:14:51
    溫馨提示:易賢網(wǎng)小編為您整理了“用htc實現(xiàn)驗證模塊”,方便廣大網(wǎng)友查閱!

    代碼如下:

    /***************************************************************************************

    * validate1.0

    * 此代碼版權歸海洋工作室ocean所有,您可以非商業(yè)目的使用、復制、修改此代碼,但需要

    * 保留本工作室的版權信息。如果您使用、修改此代碼為商業(yè)目的,請聯(lián)系本工作室取得使用許可。

    *

    * 如果您對本程序有什么建議,請email to:ocean@forever.net.cn。

    *

    * 海洋工作室

    *

    * ocean() 制作

    *****************************************************************************************/

    //鍵盤事件

    <public:attach event=onkeypress onevent=doevent() />

    //粘貼事件

    <public:attach event=onpaste onevent=doevent() />

    //失去焦點事件

    <public:attach event=onblur onevent=doevent() />

    <script language=jscript>

    //預定義的檢查模式

    var regarray = new array(

    new array(int+0,^\\d+$,,需要輸入一個非負整數(shù),請重新檢查), //非負整數(shù)(正整數(shù) + 0)

    new array(int+,^[0-9]*[1-9][0-9]*$,^\\d+$,需要輸入一個正整數(shù),請重新檢查), //正整數(shù)

    new array(int-0,^((-\\d+)|(0+))$,^(-|(-\\d+)|(0+))$,需要輸入一個非正整數(shù),請重新檢查), //非正整數(shù)(負整數(shù) + 0)

    new array(int-,^-[0-9]*[1-9][0-9]*$,^(-|(-\\d+)|(0+))$,需要輸入一個負整數(shù),請重新檢查), //負整數(shù)

    new array(int,^-?\\d+$,^-|(-?\\d+)$,需要輸入一個整數(shù),請重新檢查), //整數(shù)

    new array(double+0,^\\d+(,需要輸入一個非負浮點數(shù),請重新檢查), //非負浮點數(shù)(正浮點數(shù) + 0)

    new array(double+,^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$,^((,需要輸入一個正浮點數(shù),請重新檢查), //正浮點數(shù)

    new array(double-0,^((-\\d+(,需要輸入一個非正浮點數(shù),請重新檢查), //非正浮點數(shù)(負浮點數(shù) + 0)

    new array(double-,^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$,^(-|(-\\d+\\.?)|(-\\d+\\.\\d+))$,需要輸入一個負浮點數(shù),請重新檢查), //負浮點數(shù)

    new array(double,^(-?\\d+)(,需要輸入一個浮點數(shù),請重新檢查), //浮點數(shù)

    new array(char,^[a-za-z]+$,,您只能輸入英文字母,請重新檢查), //由26個英文字母組成的字符串

    new array(upperchar,^[a-z]+$,,您只能輸入英文大寫字母,請重新檢查), //由26個英文字母的大寫組成的字符串

    new array(lowerchar,^[a-z]+$,,您只能輸入英文小寫字母,請重新檢查), //由26個英文字母的小寫組成的字符串

    new array(digitchar,^[a-za-z0-9]+$,,您只能輸入數(shù)字和英文字母,請重新檢查), //由數(shù)字和26個英文字母組成的字符串

    new array(digitchar_,^\\w+$,,您只能輸入數(shù)字、英文字母和下劃線,請重新檢查), //由數(shù)字、26個英文字母或者下劃線組成的字符串

    new array(email,^[\\w-]+(,需要輸入正確的email地址,請重新檢查), //email地址

    new array(url,^[a-za-z]+://(>,需要輸入正確的url地址,請重新檢查) //url

    );

    //受控元素默認的事件處理程序

    function doevent() {

    //得到觸發(fā)事件的類型

    var type = window.event.type;

    //得到觸發(fā)元素的值。

    var value = window.event.srcelement.value;

    if (type == keypress) { //如果是鍵盤按下事件,得到鍵盤按下后的值

    var keycode = window.event.keycode;

    if (typeof(window.event.srcelement.upper) != undefined) { //如果定義了轉換大寫

    if (keycode >= 97 && keycode <= 122)

    keycode = window.event.keycode = keycode - 32;

    }

    else if (typeof(window.event.srcelement.lower) != undefined) { //如果定義了轉換小寫

    if (keycode >= 65 && keycode <= 90)

    keycode = window.event.keycode = keycode + 32;

    }

    value += string.fromcharcode(keycode);

    }

    else if (type == paste) {

    value += window.clipboarddata.getdata(text);

    }

    //如果觸發(fā)元素的值為空,則表示用戶沒有輸入,不接受檢查。

    if (value == ) return;

    //如果觸發(fā)元素沒有設置reg屬性,則返回不進行任何檢查。

    if (typeof(window.event.srcelement.reg) == undefined) return;

    //如果觸發(fā)元素沒有定義check屬性,則在按鍵和粘貼事件中不做檢查

    if ((type == keypress || type == paste) && typeof(window.event.srcelement.check) == undefined) return;

    //如果沒有通過檢查模式,出現(xiàn)的錯誤信息

    var msg = ;

    //得到檢查模式

    var reg = window.event.srcelement.reg;

    //正則表達式對象

    var regexp = null;

    //從預定義的檢查模式中查找正則表達式對象

    for (var i=0;i<regarray.length;i++) {

    if (regarray[i][0] == reg) {

    if ((type == keypress || type == paste) && regarray[i][2] != )

    regexp = new regexp(regarray[i][2]); //查找到預定義的檢查模式

    else

    regexp = new regexp(regarray[i][1]); //查找到預定義的檢查模式

    msg = regarray[i][3]; //定義預定義的報錯信息

    break; //查找成功,退出循環(huán)

    }

    }

    if (regexp == null) { //如果沒有查找到預定義的檢查模式,說明reg本身就為正則表達式對象。

    if ((type == keypress || type == paste) && typeof(window.event.srcelement.regcheck) != undefined)

    regexp = new regexp(window.event.srcelement.regcheck); //按照用戶自定義的正則表達式生成正則表達式對象。

    else

    regexp = new regexp(reg); //按照用戶自定義的正則表達式生成正則表達式對象。

    msg = 輸入錯誤,請重新檢查; //錯誤信息

    }

    //檢查觸發(fā)元素的值符合檢查模式,直接返回。

    if (regexp.test(value)) return;

    if (type == blur) { //如果是失去焦點并且檢查不通過,則需要出現(xiàn)錯誤警告框。

    //判斷用戶是否自己定義了錯誤信息

    if (typeof(window.event.srcelement.msg) != undefined)

    msg = window.event.srcelement.msg;

    //顯示錯誤信息

    alert(msg);

    //將焦點重新聚回觸發(fā)元素

    window.event.srcelement.focus();

    window.event.srcelement.select();

    }

    else { //如果是鍵盤按下或者粘貼事件并且檢查不通過,則取消默認動作。

    //取消此次鍵盤按下或者粘貼操作

    window.event.returnvalue = false;

    }

    }

    </script>

    應用例子:

    代碼如下:

    <html>

    <head>

    <style type=text/css>

    table {

    width:100%;

    }

    input {

    behavior:url(validate.htc);

    }

    </style>

    </head>

    <body style=margin:0>

    <table>

    <tr><td><a href=> border=0 src=logo.jpg></a></td></tr>

    </table>

    <br>

    <table style=margin-left:20px>

    <tr>

    <td>驗證規(guī)則</td>

    <td>實時檢測</td>

    <td>失去焦點時檢測</td>

    </tr>

    <tr>

    <td>非負整數(shù)(正整數(shù) + 0)</td>

    <td><input type=text value= reg=int+0 check></td>

    <td><input type=text value= reg=int+0></td>

    </tr>

    <tr>

    <td>正整數(shù)</td>

    <td><input type=text value= reg=int+ check></td>

    <td><input type=text value= reg=int+></td>

    </tr>

    <tr>

    <td>非正整數(shù)(負整數(shù) + 0)</td>

    <td><input type=text value= reg=int-0 check></td>

    <td><input type=text value= reg=int-0></td>

    </tr>

    <tr>

    <td>負整數(shù)</td>

    <td><input type=text value= reg=int- check></td>

    <td><input type=text value= reg=int-></td>

    </tr>

    <tr>

    <td>整數(shù)</td>

    <td><input type=text value= reg=int check></td>

    <td><input type=text value= reg=int></td>

    </tr>

    <tr>

    <td>非負浮點數(shù)(正浮點數(shù) + 0)</td>

    <td><input type=text value= reg=double+0 check></td>

    <td><input type=text value= reg=double+0></td>

    </tr>

    <tr>

    <td>正浮點數(shù)</td>

    <td><input type=text value= reg=double+ check></td>

    <td><input type=text value= reg=double+></td>

    </tr>

    <tr>

    <td>非正浮點數(shù)(負浮點數(shù) + 0)</td>

    <td><input type=text value= reg=double-0 check></td>

    <td><input type=text value= reg=double-0></td>

    </tr>

    <tr>

    <td>負浮點數(shù)</td>

    <td><input type=text value= reg=double- check></td>

    <td><input type=text value= reg=double-></td>

    </tr>

    <tr>

    <td>浮點數(shù)</td>

    <td><input type=text value= reg=double check></td>

    <td><input type=text value= reg=double></td>

    </tr>

    <tr>

    <td>由26個英文字母組成的字符串</td>

    <td><input type=text value= reg=char check></td>

    <td><input type=text value= reg=char></td>

    </tr>

    <tr>

    <td>由26個英文字母的大寫組成的字符串(輸入小寫字母會自動轉換成大寫)</td>

    <td><input type=text value= reg=upperchar check upper></td>

    <td><input type=text value= reg=upperchar upper></td>

    </tr>

    <tr>

    <td>由26個英文字母的小寫組成的字符串(輸入大寫字母會自動轉換成小寫)</td>

    <td><input type=text value= reg=lowerchar check lower></td>

    <td><input type=text value= reg=lowerchar lower></td>

    </tr>

    <tr>

    <td>由數(shù)字和26個英文字母組成的字符串</td>

    <td><input type=text value= reg=digitchar check></td>

    <td><input type=text value= reg=digitchar></td>

    </tr>

    <tr>

    <td>由數(shù)字、26個英文字母或者下劃線組成的字符串</td>

    <td><input type=text value= reg=digitchar_ check></td>

    <td><input type=text value= reg=digitchar_></td>

    </tr>

    <tr>

    <td>email地址</td>

    <td><input type=text value= reg=email check></td>

    <td><input type=text value= reg=email></td>

    </tr>

    <tr>

    <td>url</td>

    <td><input type=text value= reg=url check></td>

    <td><input type=text value= reg=url></td>

    </tr>

    <tr>

    <td>自定義規(guī)則(只能輸入aaa),自定義報錯信息</td>

    <td><input type=text value= reg=^aaa$ regcheck=^a{1,3}$ msg=只能輸入aaa check></td>

    <td><input type=text value= reg=^aaa$ regcheck=^a{1,3}$ msg=只能輸入aaa></td>

    </tr>

    </table>

    <hr width=50% style=color: #ff0000>

    <div style=text-align:center;font-size:9pt>copyright 2004 © 海洋工作室(<a href=>)</div>

    <p> </p>

    <p> </p>

    <p> </p>

    <p> </p>

    </body>

    </html>

    更多信息請查看腳本欄目
    易賢網(wǎng)手機網(wǎng)站地址:用htc實現(xiàn)驗證模塊

    2026國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網(wǎng)