为了账号安全,请及时绑定邮箱和手机立即绑定

想让鼠标移入时阴影消失,移出时阴影效果恢复,这么写是哪里错了吗?

<!doctype html>
<html>
<head>
<title>练习</title>
<meta charset="utf-8"/>
<base target="_blank">
<link rel="shortcut icon" type="text/css" href="logo.ico">
<style type="text/css">
.a1{
	background-color: #fff; 
	width: 200px; 
	height: 270px; 
	display: inline-block; 
	margin-left: 5px; 
	margin-right: 5px; 
	margin-top: 15px;
	border-radius: 1%;
	color: #000;
	font-size: 18px;
	box-shadow: 1px 1px 3px #ccc;
}
img{
	border-top-left-radius: 1%; 
	border-top-right-radius: 1%;
}
a{
	text-transform: none; 
	text-decoration: none;
}
</style>

<script>
	function over(x){
		x.style.opacity="0.75";
		x.style.box-shadow="0px 0px 0px #fff";//加了这行,鼠标的移入移出效果就无效。没有这行就一切正常。
	}
	function out(x){
		x.style.opacity="1";
		x.style.box-shadow="1px 1px 3px #ccc";//加了这行,鼠标的移入移出效果就无效。没有这行就一切正常。
	}
</script>

</head>

<body style="background-color: #eee; margin: 0px; font-family: Microsoft Yahei;">
	<div style="text-align: center;">
	  <div style="width: 1285px; display: inline-block; margin-top: 30px; text-align: center;">
		<div style="width: 100%; text-align: left;">
		  <a href="http://www.baidu.com" class="a1" onmouseover="over(this)" onmouseout="out(this)" >
			<img src="http://tupian.enterdesk.com/2013/mxy/12/11/4/3.jpg" style="width:200px; height:200px; ">
			<p style="text-align: center;">一二三四五</p></a>
		  <a href="http://www.baidu.com" class="a1" onmouseover="over(this)" onmouseout="out(this)" >
			<img src="http://tupian.enterdesk.com/2013/mxy/12/11/4/3.jpg" style="width:200px; height:200px; ">
			<p style="text-align: center;">一二三四五</p></a>
		  <a href="http://www.baidu.com" class="a1" onmouseover="over(this)" onmouseout="out(this)" >
			<img src="http://tupian.enterdesk.com/2013/mxy/12/11/4/3.jpg" style="width:200px; height:200px; ">
			<p style="text-align: center;">一二三四五</p></a>
	    </div>
	  </div>
    </div>
</body>
</html>


正在回答

1 回答

改成下面这个试下

x.style.boxShadow="0px 0px 0px #fff";

0 回复 有任何疑惑可以回复我~
#1

望尤 提问者

完美解决!这几天都没来,没及时采纳。
2017-09-09 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

想让鼠标移入时阴影消失,移出时阴影效果恢复,这么写是哪里错了吗?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信