为什么js只能获取id加classname,但是tagname就不行?如图

插入不了图片了,上代码

<body>
 	<div class="ball_1" >
         <span><?php $nu ?></span>
    </div>
     <div class="ball_2">
         <span><?php $nu ?></span>
    </div> 	
    <div class="ball_3">
         <span><?php $nu ?></span>
    </div> 	
    <div class="ball_4">
         <span><?php $nu ?></span>
    </div> 	
    <div class="ball_5">
         <span><?php $nu ?></span>
    </div>
	<div id="ball_6" class="ball_6">
         <span><?php $nu ?></span>
    </div> 	
    <br/><br/><br/><br/>
    <input type="button" value="赌博一下" onclick="" />
    <script type="text/javascript">
    	var ball2=document.getElementsByTagName("div").className;
        var ball1=document.getElementById("ball_6").className;
        alert(ball2);


侠客岛的含笑
浏览 55回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP