<html>
<head>
<title>123</title>
<style>
</style>
</head>
<body>
<div>123</div>
<div>456</div>
<script>
function test(object){
var tag = object.innerHTML;
alert(tag)
}
var divs = document.getElementsByTagName('div');
for(var i = 0, len = divs.length; i < len; i++){
divs[i].onclick = function(){
test(this)
}
}
</script>
</body>
</html>