源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> </head> <body> <h1>我的 Web 頁面</h1> <p id="demo">一個段落。</p> <button type="button" onclick="myFunction()">點擊這里</button> <p><b>注釋:</b>myFunction 保存在名為 "myScript.js" 的外部文件中。</p> <script src="myScript.js"></script> </body> </html>
運行結果