我們先來看下具體的演示效果圖

以下就是完整的HTML頁面代碼,大家可以測試下。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .big_box{ width: 500px; height: 500px; border: 1px solid black; } .big_box input{ margin-left: 60px; } </style> <script> function Change_red(){ var Red=document.getElementById("change_style"); Red.style.backgroundColor="red"; } function Change_blue(){ var Blue=document.getElementById("change_style"); Blue.style.backgroundColor="blue"; } function Change_green(){ var Green=document.getElementById("change_style"); Green.style.backgroundColor="green"; } </script> </head> <body> <div class="big_box" id="change_style"> <input type="button" value="變?yōu)榧t色" onclick="Change_red()"> <input type="button" value="變?yōu)樗{色" onclick="Change_blue()"> <input type="button" value="變?yōu)榫G色" onclick="Change_green()"> </div> </body> </html> 新聞熱點
疑難解答