http://www.jb51.net/article/56316.htm

 
<!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=utf-8" />
    
    <title>无标题文档</title>
    
    <style>
    
    .ca{background-color:red; padding:20px;}
    
    .js{ border:1px solid #00F; padding:10px;}
    
    </style>
 
</head>
 
 
<body>
 
    <div class="ca"> sss </div>
    
    <div class="js" );}
 
a[1].innerHTML='我们来了';
 
</script>

有时候会有多个dom的class相同,可以这样处理:


var a=getElementsClass("ca");
for(var i=0;i<a.length;i++){
(function(i){
alert(a[i])
})(i)
}


如果有多个相同的class也可以一起用了,如果是想达到JQ哪里可以直接.click还需要做一些比较复杂的处理

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2021-06-08
  • 2021-11-21
  • 2021-07-12
  • 2022-12-23
猜你喜欢
  • 2021-08-31
  • 2022-12-23
  • 2021-05-28
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案