亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

DOM ??? ?? ?? ??

DOM ??? ?? ?? ??

img ??:

<img src="images/image.1.jpg" id="hibiscus" alt="Hibiscus" class="classA" />

?? ????? id, src, alt ?? ? ??? "??"??? ??? ? ?????. ??? ??? "?? ??"??? ????. ??? DOM ??? ?? ??? ? ?? ????? ?? ?? ??? "DOM ??"? ?? ???? ?? ??? "?? ??"? "DOM ??"?? ?????.

??? src? ?? ??? ??????:

images/image.1.jpg

, "DOM ??"??? ?? ??? ?????:

http: //localhost/images/ image.1.jpg

?? "?? ??"? "DOM ??"? ??? ????. ?? ?? ?? ?? ?? ???? DOM ???? ??? ? className? ?????.

Javascript??? "DOM ??"? ?? ????? ??? ? ????.

<script type="text/javascript">
$(function() { var img1 = document.getElementById("hibiscus " );
?????? ??(img1.alt);
??????????????????????????????????????????????????????????????????? ??(img1.alt; ??? ???? ???. ?? ?? "class:

img1.className = "classB";
?? DOM ?? "className"? ?????.

JQuery?? "DOM ??"? ???? ??? ????. ???? "DOM ??"? ?? ???? ? javascript? ???? ?????. jQuery? jQuery ??? ??? ???? ?? Each() ??? ?????. DOM ????? ?? ?? ??????? ???? ??? DOM ??? ??? ? ????.
   $("img").each(function(index) {    
      alert("index:" + index + ", id:" + this.id + ", alt:" + this.alt);    
     this.alt = "changed";    
        alert("index:" + index + ", id:" + this.id + ", alt:" + this.alt);    
     });
??? ? ??? ?? ?????.
each( callback ) ??: jQuery ??? ??

?? ??? ??? ? ??? ?? ?? ???? 0?? ???? ?? ?? ?? ?? ???? ????? ?????.



???? ??
||
<!DOCTYPE html> <html> <body> <p id="intro">Hello World!</p> <script> x=document.getElementById("intro"); document.write(x.firstChild.nodeValue); </script> </body> </html>