如何使用DOM 來改變html的樣式
如下程式碼:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>DOM 与 CSS</title> </head> <body> <div name="dv" id="dv" width="300" height="200">php 中文网</div> <script type="text/javascript"> var dv = document.getElementById("dv").style.color = "red"; </script> </body> </html>