一个奇怪的js问题,求大神解答
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<style>
#ccc{position:absolute;top:50%;left:50%;width:500px;height:320px;margin-left:-250px;margin-top:-160px;}
#ccc span{width:30px;height:30px;position:absolute;right:0;top:0;}
</style>
<div id="ccc">
<img src="http://www.ncwseo.com/images/tc.jpg">
<span>X</span>
</div>
<script>
var ccc = document.getElementById("ccc");
var ttt = ccc.getElementsByTagName("span");
ttt.onclick=function(){
alert(5);
}
</script>
</body>
</html>
我明明已经绑定span了 为什么onclick 点击span弹不出5