改变html样式的JS代码 写在head标签中为何不生效
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>style样式</title> <script> var mychar = document.getElementById("con"); mychar.style.color="red"; mychar.style.backgroundColor="#CCC"; mychar.style.width="300px"; </script> </head>