js小实例(显示或隐藏)
2008-12-01 11:37
253 查看
<!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>
<title>点击显示或隐藏</title>
<style type="text/css">
.dis{display:block;}
.non{display:none;}
</style>
<script type="text/javascript">
function f(oid){
var d = document.getElementById(oid);
if(d.className == "non")
d.className = "dis";
else
d.className = "non";
}
</script>
</head>
<body>
<div onclick="f('d1');">点击隐藏或显示</div>
<div id="d1" class="non">显示或隐藏</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>点击显示或隐藏</title>
<style type="text/css">
.dis{display:block;}
.non{display:none;}
</style>
<script type="text/javascript">
function f(oid){
var d = document.getElementById(oid);
if(d.className == "non")
d.className = "dis";
else
d.className = "non";
}
</script>
</head>
<body>
<div onclick="f('d1');">点击隐藏或显示</div>
<div id="d1" class="non">显示或隐藏</div>
</body>
</html>
相关文章推荐
- Vue.js 点击按钮显示/隐藏内容的实例代码
- Vue.js 点击按钮显示/隐藏内容 实例
- vue.js 左侧二级菜单显示与隐藏切换的实例代码
- js菜单点击显示或隐藏效果的简单实例
- js控制li的隐藏和显示实例代码
- js 鼠标经过显示隐藏效果实例
- js菜单点击显示或隐藏效果的简单实例
- js控制密码的显示与隐藏实例
- vue.js 左侧二级菜单显示隐藏切换 实例
- JS+CSS简单实现DIV遮罩层显示隐藏
- JS隐藏与显示字符
- vue.js显示与隐藏(v-if)
- js全页面刷新方法+jquery之超简单的div显示和隐藏特效demo
- js, 树状菜单隐藏显示
- div_显示隐藏简单例子2(displayDiv.js)
- JS+CSS简单实现DIV遮罩层显示隐藏
- 润乾报表如何通过页面js实现报表列显示和隐藏
- js 控制div 隐藏与显示
- js控制页面元素的隐藏与显示
- 实现监听下拉具体达到显示和隐藏效果的js的核心代码