• ExtJS创建选项卡


    <!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>  
            <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>  
            <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css"/> 
            <script language="javascript" src="extjs/ext-all.js"></script> 
            <script language="javascript" src="Jquery/jquery-1.8.1.min.js"></script>  
            <script type="text/javascript" src="js/tabs.js"></script>  
            <title>选项卡</title>  
            <style>  
                .main{ margin:50px auto;}  
                #add{ padding-left:10px;}  
            </style>  
        </head>  
     
        <body>  
            <div class="main">  
                <div id="add"></div>  
                <div id="tab"></div>  
            </div>  
        </body>  
    </html>  


    tabs.js

    Ext.require('Ext.tab.*');  
    Ext.onReady(function(){  
        var currentItem;  
        var tabs = Ext.createWidget('tabpanel', {  
            renderTo: 'tab',  
            resizeTabs: true,  
            enableTabScroll: true,  
            margin:'10',  
             600,  
            height: 250,  
            defaults: {  
                autoScroll:true,  
                bodyPadding: 10  
            },  
            items: [{  
                title: '选项卡',  
                html: '选项卡内容',  
                closable: true  
            }]  
              
        });        
        var index = 0;  
          
        function addTab (closable) {  
            ++index; 
            tabs.add({  
                title: '新选项卡- ' + index,  
                html: '新选项卡内容 ' + index + '<br/><br/>',  
                closable: !!closable  
            }).show();  
        }  
     
        Ext.createWidget('button', {  
            renderTo: 'add',  
            text: '创建可关闭选项卡',  
            handler: function () {  
                addTab(true);  
            }  
        });  
     
        Ext.createWidget('button', {  
            renderTo: 'add',          text: '创建不可关闭选项卡',  
            handler: function () {  
                addTab(false);  
            },  
            style: 'margin-left: 8px;'  
        });  
    });
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <HTML>
        <HEAD>
            <TITLE></TITLE>
            <meta http-equiv="Content-Type" content="text/html; charset=gbk">
            <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
            <!--<script type="text/javascript" src="extjs/ext-base.js"></script>-->
            <script type="text/javascript" src="extjs/ext-all.js"></script>
            <script type="text/javascript" src="extjs/ext-lang-zh_CN.js" charset="utf-8"></script>
            <script type="text/javascript">
                Ext.onReady(function(){
                    Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
                    var strTabs = '[{"id":"BaseInfo","text":"基本信息","url":"http://www.baidu.com"},{"id":"fromInfo","text":"供货信息","url":"http://www.sohu.com"},{"id":"toInfo","text":"物流信息","url":"http://www.163.com"}]';
                    var oTabs = eval('(' + strTabs + ')');
                    if (oTabs != null && oTabs.length > 0) {
                        document.getElementById("frmContent").src = oTabs[0].url;
                        var tabs = new Ext.TabPanel({
                            renderTo: 'tabsContent',
                            activeTab: 0,
                            collapsed: true,
                            items: [{
                                id: oTabs[0].id,
                                title: oTabs[0].text,
                                contentEl: 'tabItem'
                            }]
                        });
                        
                        for (var j = 1; j < oTabs.length; j++) {
                            var oItem = {};
                            oItem.id = oTabs[j].id;
                            oItem.title = oTabs[j].text;
                            oItem.contentEl = 'tabItem';                      
                            tabs.add(oItem);
                        }
                        
                        tabs.addListener("tabchange", function(tabs, nowtab){
                            for (var s = 0; s < oTabs.length; s++) {
                                if (oTabs[s].id == nowtab.id) {
                                    document.getElementById("frmContent").src = oTabs[s].url;
                                    break;
                                }
                            }
                        });
                    }
                    else {
                        document.getElementById("tabsContent").style.display = "none";
                    }
                });
            </script>
        </HEAD>
        <BODY>
            <div id="tabsContent" style="margin-top: 2px;">
                <div id="tabItem" style=" 0px; height: 0px;">
                </div>
            </div>
            <div id="tabItemsRender" style="height: 640px; overflow: auto; border-left-style: solid; border-left- 1px; border-left-color: #8DB2E3; border-right-style: solid; border-right- 1px; border-right-color: #8DB2E3; border-bottom-style: solid; border-bottom- 1px; border-bottom-color: #8DB2E3;">
                <iframe id="frmContent" name="frmContent" src="http://blog.163.com/baihongtao_618/blog/" frameborder="0" height="100%" width="100%">
                </iframe>
            </div>
        </BODY>
    </HTML>
  • 相关阅读:
    JavaCV音视频开发宝典:录制vp8和vp9编码的webm格式视频,以mp4转webm为例
    JavaCV音视频开发宝典:使用JavaCV采集windows系统声音并录制成mp3音频文件(FFmpeg采集windows系统声音)
    JavaCV音视频开发宝典:使用JavaCV和springBoot实现httpflv直播服务,无需流媒体服务,浏览器网页flv.js转封装方式播放rtsp,rtmp和桌面投屏实时画面
    linux用户用户组与ACL
    QUIC协议详解
    技术分享 | 黑盒测试方法论—等价类
    技术分享 | 这些常用测试平台,你们公司在用的是哪些呢?
    干货 | 测试专家(前阿里P8)聊测试职业发展常见瓶颈
    如何做好测试开发?| 破解测试人技术成长常见的 3 种错误思维!
    技术分享 | 黑盒测试方法论—因果图
  • 原文地址:https://www.cnblogs.com/mingforyou/p/3275055.html
Copyright © 2020-2023  润新知