您好,欢迎访问一九零五行业门户网

javascript getElementByTagName的使用_javascript技巧

javascript getelementbytagname的使用_javascript技巧
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=gb2312" /> <title>javascript getelementbytagname的使用</title> <style type="text/css"> .dd1{ color:#ff0000; } .dd2{ color:blue; } </style> <script type="text/javascript"> function changecolor() { //document.getelementbyid("s1").getelementsbytagname("a").classname="dd2"; var obj1,num,i; obj1=document.getelementbyid("s1").getelementsbytagname("a"); num=document.getelementbyid("s1").getelementsbytagname("a").length; for (i=0;i<num;i++) { obj1[i].classname="dd2"; } } </script> </head> <body> <div id="s1" onmouseover="changecolor()"> <a href="ddd" class="dd1">dfdfd</a> <a href="ddd" class="dd1">dfdfd</a> <a href="ddd" class="dd1">dfdfd</a> </div> </body> </html>
以上就是的内容。
其它类似信息

推荐信息