直接写在html标签里:
<h1 onclick="this.innerHTML='谢谢!'">请点击该文本</h1>
另外一种在脚本里调用:
<!DOCTYPE html> <html> <head> <script> function changetext(id) { id.innerHTML="谢谢!"; } </script> </head> <body> <h1 onclick="changetext(this)">请点击该文本</h1> </body> </html>
直接写在html标签里:
<h1 onclick="this.innerHTML='谢谢!'">请点击该文本</h1>
另外一种在脚本里调用:
<!DOCTYPE html> <html> <head> <script> function changetext(id) { id.innerHTML="谢谢!"; } </script> </head> <body> <h1 onclick="changetext(this)">请点击该文本</h1> </body> </html>