JavaScript Technical Skills Encyclopedia (i)

Source: Internet
Author: User
Tags add object expression html tags regular expression return window
Tips//Various sizes S + + "\ r \ n page visible area wide:" + document.body.clientWidth;
s + + "\ r \ n page visible Area High:" + document.body.clientHeight;
s + + "\ r \ n" page visible area High: "+ Document.body.offsetWeight +" (including the edge of the width);
s + + "\ r \ n" page visible area High: "+ Document.body.offsetHeight +" (including the edge of the width);
s + + "\ r \ n page text full text width:" + document.body.scrollWidth;
s + + "\ r \ n" page full text High: "+ document.body.scrollHeight;
s + + "\ r \ n Pages are rolled High:" + document.body.scrollTop;
s + + "\ r \ n page is rolled to the left:" + document.body.scrollLeft;
s + + "\ r \ n Page body part:" + window.screentop;
s + + "\ r \ n Page body part left:" + window.screenleft;
s + + "\ r \ n screen resolution of High:" + window.screen.height;
s + + "\ r \ n Screen resolution width:" + window.screen.width;
s + = "\ r \ n Screen available working area height:" + window.screen.availHeight;
s + = "\ r \ n Screen available working area width:" + window.screen.availWidth;

    //Filter Digital <input type=text onkeypress= "Return event.keycode>=48&&event.keycode<=57| | (This.value.indexOf ('. ') <0?event.keycode==46:false) "onpaste=" Return!clipboarddata.getdata (' text '). Match (/\d/) "ondragenter=" return False ">

    //Special purpose <input type=button value= Import Favorites >
    <input Type=button value= Export Favorites >
    <input Type=button value= Sorting Favorites >
    <input Type=button value= Language Settings >
    <input Type=button value= Add Favorites >
    <input Type=button value= add to Channel >
    <input Type=button value= add to Channel >

    //Do not cache <meta http-equiv= "pragma" content= "No-cache" >
    <meta http-equiv= "Cache-control" content= "No-cache, must-revalidate" >
    <meta http-equiv= "Expires" content= "0" >


    //Regular match

    Matching regular expressions for Chinese characters: [\U4E00-\U9FA5]
    Match Double-byte characters (including Chinese characters): [^\x00-\xff]
    A regular expression that matches a blank row: \n[\s|] *\r
    Regular expression matching HTML tags:/< (. *) >.*<\/\1>|< (. *) \/>/
    Matching a regular expression with a trailing space: (^\s*) | (\s*$) (Trim function like VBScript)
    Regular expression matching an email address: \w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *
    A regular expression that matches URL URLs: http://([\w-]+\.) +[\w-]+ (/[\w-/?%&=]*)?
    Here is an example:
    Use regular expressions to restrict the entry of text boxes in a Web page's form:
    The regular expression limit can only be entered in Chinese: onkeyup= "value=value.replace (/[^\u4e00-\u9fa5]/g,") "Onbeforepaste=" Clipboarddata.setdata (' Text ', Clipboarddata.getdata (' text '). Replace (/[^\u4e00-\u9fa5]/g, ') "
    1. Only full-width characters can be entered with regular expression restrictions: onkeyup= "Value=value.replace (/[^\uff00-\uffff]/g,") "Onbeforepaste=" Clipboarddata.setdata (' Text ', Clipboarddata.getdata (' text '). Replace (/[^\uff00-\uffff]/g, ') "
    2. Only numbers can be entered with regular expression restrictions: onkeyup= "Value=value.replace (/[^\d]/g,") "Onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') "
    3. Only numbers and English can be entered using regular expression restrictions: onkeyup= "Value=value.replace (/[\w]/g,") "Onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') "

    //Erase image Toolbar
    Or
    <meta http-equiv= "Imagetoolbar" content= "no" >

    No prompt shutdown

    function Close ()
    {
    var ua=navigator.useragent
    var ie=navigator.appname== "Microsoft Internet Explorer"? True:false
    if (IE)
    {
    var ieversion=parsefloat (ua.substring (Ua.indexof ("MSIE") +5,ua.indexof (";", Ua.indexof ("MSIE")))
    if (ieversion< 5.5)
    {
    var str = ' <object id=notipclose classid= ' clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11 ' > '
    str = ' <param name= ' Command ' value= ' close ' ></object> ';
    Document.body.insertAdjacentHTML ("BeforeEnd", str);
    Document.all.noTipClose.Click ();
    }
    Else
    {
    Window.opener =null;
    Window.close ();
    }
    }
    Else
    {
    Window.close ()
    }
    }

    [1] [2] Next page



    Related Article

    Cloud Intelligence Leading the Digital Future

    Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

    Register Now >

    11.11 Big Sale for Cloud

    Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

    Get It Now >

    Alibaba Cloud Free Trial

    Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

    Learn more >

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.