zoukankan      html  css  js  c++  java
  • EasyUI Tabs

    <!DOCTYPE html>
    <html>
    <head>
        <title>吹泡泡的魚-主页</title>
        <link rel="stylesheet" type="text/css" href="js/jquery-easyui/themes/gray/easyui.css">
        <link rel="stylesheet" type="text/css" href="js/jquery-easyui/themes/icon.css">
        <script type="text/javascript" src="js/jquery-easyui/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery-easyui/jquery.easyui.min.js"></script>
    </head>
    <body>
        <div style="margin-bottom:10px">
            <a href="#" class="easyui-linkbutton" onclick="showIcon()">标签页显示小图标</a>
            <a href="#" class="easyui-linkbutton" onclick="addTab('jquery','http://jquery.com/')">jquery</a>
            <a href="#" class="easyui-linkbutton" onclick="addTab('easyui','http://jeasyui.com/')">easyui</a>
            <a href="#" class="easyui-linkbutton" onclick="addTab('url','xx/xx.action')">url访问</a>
        </div>
        <div id="tt" class="easyui-tabs" style="400px;height:250px;">
            <div title="Home"></div>
        </div>
    
        <script type="text/javascript">
            //使用 'exists' 方法来判断 tab 是否已经存在,如果已存在则激活 tab。如果不存在则调用 'add' 方法来添加一个新的 tab 面板
            function addTab(title, url){
                if ($('#tt').tabs('exists', title)){
                    $('#tt').tabs('select', title);
                } else {
                    if(title=="url"){
                        $('#tt').tabs('add',{
                            title:title,
                            href:url,
                            closable:true
                        });
                    }else{
                        var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="100%;height:100%;"></iframe>';
                        $('#tt').tabs('add',{
                            title:title,
                            content:content,
                            closable:true
                        });
                    }
                    
                }
    
            }
            //在新的标签页面板后方显示小图标
            function showIcon(){
                $('#tt').tabs('add',{
                    title:'New Tab',
                    content:'Tab Body',
                    closable:true,
                    tools:[{
                        iconCls:'icon-add',
                        handler:function(){
                            alert('add')
                        }
                    },{
                        iconCls:'icon-save',
                        handler:function(){
                            alert('save')
                        }
                    }]
                });
            }
        </script>
    </body>
    </html>
  • 相关阅读:
    为什么要有handler机制
    安卓五种数据存储的方式
    Activity生命周期详解
    JS的一些简单实例用法
    JSP 中的EL表达式详细介绍
    JSP九大内置对象和四个作用域
    JS实现---图片轮播效果
    实现 鼠标移动到表格的某行 该行换背景 ---myEclipse编写
    JS 菜单收拉样式
    spring中aware接口的
  • 原文地址:https://www.cnblogs.com/jiefu/p/10043594.html
Copyright © 2011-2022 走看看