为了账号安全,请及时绑定邮箱和手机立即绑定
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utg-8" />
<title>无标题文档</title>
<style type="text/css">
*{ margin:0;padding:0;}
#home{margin:0 auto; width:1000px; background:#f00; border:1px solid #CCC; position:relative; height:400px;}
#tccl{ width:400px; height:200px; background:#FFF;float:left; text-align:center;line-height:20px;}
#tccr{ width:400px; height:200px;background:#FFF;float:right; text-align:center; line-height:20px;}
p{margin-top:90px;}
#car{width:200px; height:100px; background-color: #000;left:400px;}
</style>
<script type="text/javascript">
function okey(){
var j=document.getElementById("car");
var i=document.getElementById("car").style.top;
	if(i=="300px"){
	j.style.top="0px";
	}
	if(i=="0px"){
	j.style.top="300px";
	}
}
</script>
</head>
<body>
<div id="home">
<div id="tccl">
<p class="cen">已停车</p>
</div>
<div id="tccr">
<p class="cen">已停车</p>
</div>
<div id="car" style="position:absolute; top:300px;" onclick="okey()">
</div>
</div>
</body>
</html>

搞了一晚上,原来style.top只支持行内样式。。。。。shit

正在回答

0 回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信