鼠标悬停选项卡切换

鼠标悬停选项卡切换

代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>鼠标悬停选项卡切换</title>
		<style type="text/css">
			#div1{
				width: 400px;
				height: 200px;
				background: red;
				display: block;
			}
			#div2{
				width: 400px;
				height: 200px;
				background: blue;
				display: none;
			}
		</style>
		
		<script type="text/javascript">
			function show(str)
			{
				var show1 = document.getElementById("div1");
				var show2 = document.getElementById("div2");
				if(str == "1"){
					show1.style.display="block";
					show2.style.display="none";
				}
				if(str == "2"){
					show1.style.display="none";
					show2.style.display="block"
				}
			}
		</script>
	</head>
	<body>
		<input type="button" value="扫码登录" onmouseover="show('1')"/>
		<input type="button" value="账号登录" onmouseover="show('2')"  />
		<div id="div1">
			扫码登录
		</div>
		<div id="div2">
			账号登录
		</div>
	</body>
</html>

运行效果:

猜你喜欢

转载自blog.csdn.net/qq_40581789/article/details/80627547
今日推荐