日期:2014-05-16 浏览次数:20335 次
<!DOCTYPE HTML>
<html>
<head>
<title> DOM-createAttribute() and createElement() </title>
<meta charset="utf-8">
</head>
<body>
<button id="b" onclick="btn_click()">createElement()</button>
<script>
document.body.getElementsByTagName('button')[0].click = function(){
alert('1');
}
function btn_click(){
alert('1');
}
</script>
</body>
</html>