改变内部的 HTML
- <html>
- <head>
- <script type="text/javascript">
- function nameon()
- {
- document.getElementById('h2text').innerHTML="欢迎!"
- }
- function nameout()
- {
- document.getElementById('h2text').innerHTML="今天过得怎么样?"
- }
- </script>
- </head>
- <body>
- <h2 id="h2text" onmouseout="nameout()"
- onmouseover="nameon()">
- 请把鼠标移动到文本上!</h2>
- </body>
- </html>