DOM python front-end

The DOM:
     . 1 . Found label 
        a direct find. 
            Retrieve a single element document.getElementById ( ' I1 ' ) 
            Looking (list) doucment.getElementsByTagName (by tag name ' div ' ) 
                                doucment.getElementsByClassName ( ' C1 ' ) 
        B indirect to find. 
            Tag = doucment.getElementById ( ' I1 ' ) 
            
            parentElement         # parent tag element 
            Children              # all sub tags 
            firstElementChild      # first child element tag
            lastElementChild       # last child tag element 
            nextElementtSibling # next sibling label element 
            previousElementSibling # on a Brother label element
     
    2 . Operation label 
        a.innerText 
            get text label 
                tag .innerText 
            label text reassigned (more tags need modified loop) 
                labels .innerText = "" 
        b.innerHTML 
            if the mode re-label assignment, if the format of the content with the tag, label format will automatically be converted to HTML format, and then all innerText content directly into a string 
        b.className 
            tag.className                    # overall operation 
            tag.classList.add ( ' style name ')         # Adds the specified style 
            tag.classList.remove ( ' the style name ' )     # delete the specified style 
        c.checkbox 
            get the value 
            checkbox objects .checked 
            settings 
            checkbox objects .checked = to true (the operation of the selection box)
            
    
     3 . Create a label 
        document. the createElement ( " div " ); / * * need to tie to add nodes / 
    
    4 add nodes.
         1 append a child node. 
            d2.appendChild (new label)
         2 see this increased front node into a node. 
            parent node insertBefore. (want to add the new node before the node)
    
     5 . delete node
    
     6Alternatively Node
    
     7. Get / Set Attribute node 
        label .getAttribute ( " attribute name / type name " ) 
        tab .setAttribute ( " attribute name / class name " , " new attribute " )
            
        

 

Guess you like

Origin www.cnblogs.com/god-for-speed/p/11569910.html