求解!!!!!!!!!!!!!!!!!!!
为什么图中12行 输出的 颜色和背景 都没改变
2016-08-24
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style样式</title>
<style>
#ys{
color:red;
width:300px;
background:#ccc;
}
</style>
</head>
<body>
<h2 id="con">I love JavaScript</H2>
<p> JavaScript使网页显示动态效果并实现与用户交互功能。</p>
<script type="text/javascript">
var mychar= document.getElementById("con");
document.write("<div id=\"ys\">"+"啥玩意:"+mychar.innerHTML+
"</div>");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
machar.style.width="300px";
</script>
</body>
</html>
举报