我输入这个代码为何不行呢?在html里面也写了<p id="p1">jsjsjs</p>
document.write("hello");
document.getElementById("p1").style.color="blue";
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>test</title> </head> <body> <p id="p1">jsjsjs</p> <script type="text/javascript"> document.write("hello"); document.getElementById("p1").style.color="blue"; </script> </body> </html>