Python automation development from shallow to deep-advanced (Script,dom,jquery Foundation)

Source: Internet
Author: User
Tags html tags setinterval

    • JavaScript (can manipulate HTML tags and CSS)
    • Dom (API, provides a way to find tags in html, so that you can use JS to find the label or CSS to do the appropriate action)
    • JQuery (used to encapsulate complex logic and operations into a package for external invocation)

javascript:    <srcipt>...</script>    Forms of existence: files, blocks     generally written at the bottom of the body.     ---Declaration variable:              name = "Alex"; (global variable)       &N Bsp       var age=18,     (local variable)    ---Digital:        var age = "; "       Console.log (age,typeof age);        age = parseint (age);      &NB Sp Console.log (age,typeof Age);         var = "18.9";        console.log (par Seint (age));        Console.log (parsefloat (age));        number (' 123 ');  & nbsp     parseint (' 123 '); ---String: Console debugging is available in the browser.         var name = "abc";        var name = "ABC      ";  &nbs P     Name.trim ();     Remove null characters at the end of a string         Name. charAt (0);   Get the first character a        name.substring; Get the data equal to 1 less than 2, here is b ---boolean:        Boolean (1)             true        Boolean (0)             false  ---array:    var li = [11,22,33];    var n = [44,55,66];    var li = Array (11,22,33);    Li.push (88); Add 88 to Li (insert data back)     Li.unshift ("abc"); Put strings into Li (insert data forward)     Li.splice (1,0, ' Alex '); Put the ' Alex ' string in the 1 position, and parameter 0 is a fixed notation.     i = Li.pop ();   The Li tail data is moved out and assigned to I (removed from the tail)     i = Li.shift (); Move the Li's head value out and assign the value to I (remove from head)     Li.splice; Remove 2 elements from the 1 position in Li (the first parameter is the position, the second parameter is the number)     Li.slice (0,2); Slices, from 0 positions, to 2 (not counted), here is 11,22    m = Li.concat (n); Union, the Li and N are combined together and assigned to m    Li.reverse (); Self-flipping changes to 33,22,11    m = li.join ('-');   '-' for delimiter,11-22-33    name = ' Zhaohong ';    name.length; Get string length ---dictionary:    dic = {"K1": ' v1 '} Creates a dictionary, is an object  ---serialization and deserialization:    s = json.stringify (DIC)   will DIC The dictionary is serialized to a string     m = Json.parse (s)   will serialize S, deserialized to an object     --undefined    var name = "Jake"         undefined  If a value is not assigned to a defined variable, undefined such as: Var SS,  ss is displayed as Undefiled, and the Boolean value is false& Nbsp;name = null points to a special address, a null boolean value of false ---Loop statement:    LI = [11,22,33,44];    for (var item in Li) {        Console.log (item),  //output for index    }     var dic = {' K1 ': One, ' K2 ': 22 };    for (var item in DIC) {        Console.log (item)//output is key   }   &NB Sp for (Var i=0;i<100;i++) {        Console.log (i);   }       & nbsp  for (var i=0;i<li.length;i++) {        Console.log (i);   }  while ( true) {       continue;    break;} Same as a while loop in Python  ---conditional statement:    &NBSP;IF (condition) {}else if (condition) {}else{ } switch (name) {    Case 1:        Console.log (' 111 ');        break;    Case: &nbsp ;       ....     default:        ...}   ---exception handling:    try{    }catch (e) {    }finally{    }    --- dom let js move        obj = Foo ()        obj.xx        document        1, find elements first, then manipulate elements.         2, getElementsByTagName ()         3, getElementById ();      & nbsp 4, Getelementsbyclassname ();          <div>            <div id= "N1" >c1</div>            <a>test</a>            <ul>            &N Bsp <li>a</li>                <li>b</li>                <li>c</li>            &LT;/UL&GT ;    </div>    <script src= "" type= "Text/javascript" >        var nid = document.getElementById (' N1 ')         Nid.innertext;                 View tag content         Nid.innertext = "Jake";   Set tag content          var li_list=document.getelementbytagname (' Li ');        for Var i in li_list) {            var item = li_list[i];        & nbsp   item.innertext=i;         }    &LT;/SCRipt>            Change the text C1 of the DIV to Alex, Console.log (Nid.innertext); Display label contents      values in  input are required. Value get         Console.log (Username.value,pwd.value) ;     <div>            <div id= "num" >1</div>            <input type= "button" value= "+1" onclik= "Add ();"/>    </div>  &nbs P <script type = "Text/javascript" >        var nid = document.getElementById (' num ');        var text = nid.innertext;        Text = parseint (text);        text + = 1;        Nid.innertext = text;    </script>     Step:    &N Bsp   1, find num        2, get content         3, auto- 1, event 2, select Find (selector) 3, content modification get   & nbsp InnerText-Label Intermediate text content     innerhtml-Label Middle Content      Special:        input, select, textarea use value to get values   ---search box example:    1, onfocus,onblur    2, select the search box.     3, Get search box content value <body>    <input type= "text" id= "search" value= "Please enter the keyword" onfocus= " Focus (); "Onblur=" Blur (); "/>    <script type=" Text/javascript ">          & nbsp function Focus () {                var Nid=document.getelementbyid (' Search ');                 var value=nid.value;            &NBS P   if (value== "Please enter keywords") {                  nid.value= "";  &nbsp ;            }           }         &N Bsp   function () {                var Nid=document.getelemEntbyid (' search ');                var value=nid.value;                if (!value.trim ()) {                    Nid.va Lue = "Please enter keyword";               }           }    </script></body>  ----Creating tags:    <script>       // Create tags, add to container         var nid=document.getelementbyid (' container ');        var tag = "<input type= ' text '/>"         container.insertadjacenthtml (' beforebegin ', tag)     </script>            var creatobj = documet.createelment (' A ');    createobj.href = "http://www.etiantian.org";    createobj.innertext = "Old boy education";   & nbsp;    var nid = Document.getelementByid (' container ');    Nid.appendchild (createobj);     ---Setting label properties:    Nid.setattribute (' name ', ' AAA ')     getattribute    delattribute  ----form:    <body>        <form action= "/tijiao" method= "POST" >          &NB Sp <input name= "Query" type= "text"/>            <input type= "Submit" value= "Submit"/>         </form>    </body>    --page refresh:   Window.location.reload ()--page jump: windows.location.href = "http://www.etiantian.org"  --timer:    < script>        setinterval ("Action", "interval")         setinterval ("alert (' 123 ') )     </script>---filter:    <table>        &LT;TR&GT;&LT;TD >header 1</td></tr>        <tr>&Lt;td>value 1</td></tr>        <tr><td>value 2</td></ tr>    </table>     $ ("Tr:eq (1)")     $ (' tr '). EQ (1)      num = Input ()     TEMP = "Tr:eq (" + num + ")"     $ (temp)   

Python automation development from shallow to deep-advanced (Script,dom,jquery Foundation)

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.