这个JavaScript显示隐藏的功能怎么实现不了?

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>显示隐藏</title>
<style>
#div1{
width: 100px;
height: 400px;
background-color: #ccc;
display: none;
}
</style>
</head>
<body>
<input type="button" value="Button" onclick="showHide()">
<div id="div1"></div>

<script>
function showHide() {
var oDiv = document.getElementById('div1')
if (oDiv.display == 'block');
oDiv.display = 'none'
else
oDiv.display = 'block';
}
</script>
</body>
</html>

翻阅古今
浏览 459回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript