源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> <script> function addBorder(){ document.getElementById("compman").border="2"; } </script> </head> <body> <img id="compman" src="/images/logo.png" alt="Computerman" width="107" height="98"> <br><br> <input type="button" onclick="addBorder()" value="加上邊框"> </body> </html>
運行結果