标题:请问这段代码为啥执行不了问题找不出来
只看楼主
于云
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2020-7-27
 问题点数:0 回复次数:1 
请问这段代码为啥执行不了问题找不出来
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        
        <style type="text/css">
        *{margin: 0;padding: 0;}
        .zxw{float: left;margin:0 1px;font-size:14;color: sienna;}
   
    </style>
    </head>
    <body>
        
        <div class="zxw"style=" width: 100px;height: 100px;background:red;"></div>
        <div class="zxw"style=" width: 100px;height: 100px;background:red;"></div>
        <div class="zxw"style=" width: 100px;height: 100px;background:red;"></div>
        <div class="zxw"style=" width: 100px;height: 100px;background:red;"></div>


        
    </body>
        <script type="text/javascript">
            
   
            
            function abc(){
                    this.innerText=Math.random();
                    this.style.background="green";
                    this.style.height="300px";
                    };
        window.onclick=function(){
            var zxw= document.getElementsByClassName("zxw");
            for(var b=0; b<zxw.length; b++) {
            
                        zxw[b].addEventlistener("click",abc)
                    };
            
               
                    
            };
   
</html>
搜索更多相关主题的帖子: style background class red div 
2020-07-27 13:49
mwnb
Rank: 2
等 级:论坛游民
帖 子:7
专家分:20
注 册:2020-3-26
得分:0 
你的Listener的l没有大写
2020-08-18 19:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-502648-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.280108 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved