第一个事件动画

原创 2018-12-28 07:15:18 165
摘要:<!DOCTYPE html> <html> <head> <title>事件</title> <style type="text/css"> #box { width: 200px; height: 200px; border:&
<!DOCTYPE html>
<html>
<head>
	<title>事件</title>
	<style type="text/css">
		#box {
			width: 200px;
			height: 200px;
			border: 5px pink solid;
			background: #ccc;
		}
	</style>
	<script type="text/javascript">
		function mybox(x) {
			if(x.style.background = '#ccc'){
				x.style.border = '5px #ccc solid';
				x.style.background = 'pink';
				x.style.borderRadius = '50%';
			}else {
				x.style.border = '5px pink solid';
				x.style.background = '#ccc';
				x.style.borderRadius = none;
			}
		}
	</script>
</head>
<body>
<div id="box" onclick="mybox(this)"></div>
</body>
</html>

else中的代码为什么不执行呢

批改老师:天蓬老师批改时间:2018-12-28 09:31:32
老师总结:x.style.backgroundColor = 'pink'; 推荐写完整

发布手记

热门词条