HTML
document.all
document.querySelectorAll(CSS selectors)
Mid.querySelectorAll(CSS selectors) <div id="Mid" style="display:none"> <div class="item" >111</div> <div class="item" >222 </div> <div class="item" >333 </div> <span>333</span> </div> <script> var x = Mid.querySelectorAll("*"); var i ,txt="" ; for( i=0 ; i< x.length ;i++){ txt += "<br> x[" +i+"].tagName = " + x[i].tagName } ; dp.innerHTML= txt ; </script>
Mid.querySelectorAll(CSS selectors) <div id="Mid" style="display:none"> <div class="item" >111</div> <div class="item" >222 </div> <div class="item" >333 </div> <span>333</span> </div> <script> var x = Mid.querySelectorAll(".item") ; var i ,txt="" ; for( i=0 ; i< x.length ;i++){ txt += "<br> x[" +i+"].tagName = " + x[i].tagName } ; dp.innerHTML= txt ; </script>
Mid.querySelectorAll(CSS selectors) <div id="Mid" style="display:none"> <div class="item" >111</div> <div class="item" >222 </div> <div class="item" >333 </div> <span>333</span> </div> <script> var x = Mid.querySelectorAll("div") ; var i ,txt="" ; for( i=0 ; i< x.length ;i++){ txt += "<br> x[" +i+"].tagName = " + x[i].tagName } ; dp.innerHTML= txt ; </script>
Mid.querySelectorAll(CSS selectors) <div id="Mid" style="display:none"> <div class="item" >111</div> <div class="item" >222 </div> <div class="item" >333 </div> <span>333</span> </div> <script> var x = Mid.querySelectorAll("span") ; var i ,txt="" ; for( i=0 ; i< x.length ;i++){ txt += "<br> x[" +i+"].tagName = " + x[i].tagName } ; dp.innerHTML= txt ; </script>
沒有留言:
張貼留言