实现这样一个效果为什么会出错
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style type="text/css">
div
{
width: 200px;
height: 200px;
background: red;
display:none;
}
</style>
<script>
window.onload = function () {
var a = document.getElementsByTagName("input")[0];
var b = document.getElementsByTagName("input")[1];
var c = document.getElementsByTagName("div")[0];
a.onclick = function () { c.style.diaplay = 'none'; c.style.background = 'yellow'; c.style.width = '300'; }
b.onclick = function () { c.style.display ='block'; }
}
</script>
</head>
<body>
<input type="button" value="显示" /><input type="button" value="隐藏" /><span><a>我也要让他显示</a></span>
<div class="box"></div>
</body>
</html>小哈哈v
相关分类