web前端选项卡的写法
来源:互联网 发布:netbeans php xdebug 编辑:程序博客网 时间:2024/06/04 20:14
tab选项卡的一种写法
css: <style type="text/css"> input{ background: white; } .active{ background: yellow; } div{ width: 100px; height:100px; background: #ccc; border: 1px solid red; display: none; } </style>javascript: <script type="text/javascript"> window.onload=function(){ var aBtn=document.getElementsByTagName('input'); var divOne=document.getElementsByTagName("div"); var i=0; for(i=0;i<aBtn.length;i++){ aBtn[i].index=i; aBtn[i].onclick=function(){ for(i=0;i<aBtn.length;i++){ aBtn[i].className=""; divOne[i].style.display="none" } divOne[this.index].style.display="block"; this.className="active"; } } } </script>html:<input type="button" class="active" value="1"><input type="button" value="2"><input type="button" value="3"><div style="display: block;" > aaaaaaaaaaaaa</div><div > abbbbbbbbbbbbbbbbbb</div><div > ddddddddddddddddd</div>
二种
jquery:
$(document).ready(function(){var liClick=$("#ul1 li");/*alert(liClick.length);*/liClick.click(function(){/*alert($(this).index());*/$(".hides").hide();$("#div_"+$(this).index()).show();});});html:<div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <ul id="ul1"> <li class="lix"> 应用 </li> <li>注册</li> <li>告警</li> <li>未注册</li> </ul> </div> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div id="div_0" class="hides ui-widget-content ui-corner-all" style="display: block;"> <div class="div1" style="height: 500px;"> 11111111xxxxxxxxxxxxzzzz </div> </div> <div id="div_1" class="hides ui-widget-content ui-corner-all"> <div class="div1" style="height: 500px;"> 22222222ddddddddddddd </div> </div> <div id="div_2" class="hides ui-widget-content ui-corner-all"> <div class="div1" style="height: 500px;"> 33333333rrrrrrrrrrrrrrrrr </div> </div> <div id="div_3" class="hides ui-widget-content ui-corner-all"> <div class="div1" style="height: 500px;"> 444444444tttttttttttttttt </div> </div> </div> </div>css:<style type="text/css"> ul,li{ margin: 0px; padding: 0px; } #ul1{ list-style-type: none; height:20px; } #ul1 li{ float: left; margin-right: 10px; cursor: pointer; padding:10px 20px; } .lix{ border:1px solid #030A10; padding:10px 20px; border-color: rgba(0,0,0,.4); background: rgba(0,0,0,.1); } .hides{ display: none; } </style>
1 0
- web前端选项卡的写法
- web前端选项卡demo
- web前端 js中函数的两种常见写法
- WEB前端一些兼容IE8 浏览器的写法
- WEB前端开发学习----12. JavaScript 选项卡效果
- 选项卡面向对象写法
- web请求的写法
- web地址的写法
- 基于jQuery的简单web选项卡
- WEB简单通用的选项卡效果
- 前端<a>标签打开新的选项卡
- WEB选项卡实例
- Acticle 16:选项卡(jquery写法)
- 网页选项卡(简洁写法)
- web前端之精通dojo一:创建选项框表单
- 前端关于输入框的写法
- 前端面向对象的登录写法
- 一个web请求的写法
- RX操作符之连接操作ConnectObservable(publish、connect、replay、refCount)
- VS2010/MFC编程入门之十一(对话框:模态对话框及其弹出过程)
- IT--ganglia--报错
- Cubemap
- continue 的理解
- web前端选项卡的写法
- gulp教程之gulp-less
- 为什么Java byte 类型的取值范围是-128~127
- 跳槽与最近
- 基于cordova的webapp在线生成思路
- 杭电-1159 Common Subsequence(最长公共子序列)
- Android 万恶的三星note3拍照和图片裁剪适配
- VS2010/MFC编程入门之十二(对话框:非模态对话框的创建及显示)
- net.sf.json.JSONException: Unterminated string at character 1801