通过调用函数改变其内容:

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body> <script type="text/javascript">
function changetext(id){
id.innerHTML="Surprise!"
}
</script>
<h1 onclick="changetext(this)">点我啦</h1> </body>
</html>

 输出:

DOM事件-调用函数-LMLPHP

点击出现:

DOM事件-调用函数-LMLPHP

04-05 07:20