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

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

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

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

    代碼如下:

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

    * validate1.0

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

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

    *

    * 如果您對(duì)本程序有什么建議,請(qǐng)email to:ocean@forever.net.cn。

    *

    * 海洋工作室

    *

    * ocean() 制作

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

    //鍵盤事件

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

    //粘貼事件

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

    //失去焦點(diǎn)事件

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

    <script language=jscript>

    //預(yù)定義的檢查模式

    var regarray = new array(

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

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

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

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

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

    new array(double+0,^\\d+(,需要輸入一個(gè)非負(fù)浮點(diǎn)數(shù),請(qǐng)重新檢查), //非負(fù)浮點(diǎn)數(shù)(正浮點(diǎn)數(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]*))$,^((,需要輸入一個(gè)正浮點(diǎn)數(shù),請(qǐng)重新檢查), //正浮點(diǎn)數(shù)

    new array(double-0,^((-\\d+(,需要輸入一個(gè)非正浮點(diǎn)數(shù),請(qǐng)重新檢查), //非正浮點(diǎn)數(shù)(負(fù)浮點(diǎn)數(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+))$,需要輸入一個(gè)負(fù)浮點(diǎn)數(shù),請(qǐng)重新檢查), //負(fù)浮點(diǎn)數(shù)

    new array(double,^(-?\\d+)(,需要輸入一個(gè)浮點(diǎn)數(shù),請(qǐng)重新檢查), //浮點(diǎn)數(shù)

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

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

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

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

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

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

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

    );

    //受控元素默認(rèn)的事件處理程序

    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) { //如果定義了轉(zhuǎn)換大寫

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

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

    }

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

    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ā)元素沒有設(shè)置reg屬性,則返回不進(jìn)行任何檢查。

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

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

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

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

    var msg = ;

    //得到檢查模式

    var reg = window.event.srcelement.reg;

    //正則表達(dá)式對(duì)象

    var regexp = null;

    //從預(yù)定義的檢查模式中查找正則表達(dá)式對(duì)象

    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]); //查找到預(yù)定義的檢查模式

    else

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

    msg = regarray[i][3]; //定義預(yù)定義的報(bào)錯(cuò)信息

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

    }

    }

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

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

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

    else

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

    msg = 輸入錯(cuò)誤,請(qǐng)重新檢查; //錯(cuò)誤信息

    }

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

    if (regexp.test(value)) return;

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

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

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

    msg = window.event.srcelement.msg;

    //顯示錯(cuò)誤信息

    alert(msg);

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

    window.event.srcelement.focus();

    window.event.srcelement.select();

    }

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

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

    window.event.returnvalue = false;

    }

    }

    </script>

    應(yīng)用例子:

    代碼如下:

    <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>驗(yàn)證規(guī)則</td>

    <td>實(shí)時(shí)檢測(cè)</td>

    <td>失去焦點(diǎn)時(shí)檢測(cè)</td>

    </tr>

    <tr>

    <td>非負(fù)整數(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ù)(負(fù)整數(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>負(fù)整數(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>非負(fù)浮點(diǎn)數(shù)(正浮點(diǎn)數(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>正浮點(diǎn)數(shù)</td>

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

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

    </tr>

    <tr>

    <td>非正浮點(diǎn)數(shù)(負(fù)浮點(diǎn)數(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>負(fù)浮點(diǎn)數(shù)</td>

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

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

    </tr>

    <tr>

    <td>浮點(diǎn)數(shù)</td>

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

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

    </tr>

    <tr>

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

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

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

    </tr>

    <tr>

    <td>由26個(gè)英文字母的大寫組成的字符串(輸入小寫字母會(huì)自動(dòng)轉(zhuǎn)換成大寫)</td>

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

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

    </tr>

    <tr>

    <td>由26個(gè)英文字母的小寫組成的字符串(輸入大寫字母會(huì)自動(dòng)轉(zhuǎn)換成小寫)</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個(gè)英文字母組成的字符串</td>

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

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

    </tr>

    <tr>

    <td>由數(shù)字、26個(gè)英文字母或者下劃線組成的字符串</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),自定義報(bào)錯(cuò)信息</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>

    更多信息請(qǐng)查看腳本欄目
    易賢網(wǎng)手機(jī)網(wǎng)站地址:用htc實(shí)現(xiàn)驗(yàn)證模塊
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

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