---
title: "Ext工具条"
author: "thw"
date: "2010-12-31T16:31:15Z"
tags: ["CSS", "EXT", "JSP"]
categories: ["Web前端"]
slug: "ext"
draft: false
lastmod: "2011-01-19T17:04:16Z"
id: 857021
url: "https://thw.iteye.com/blog/857021"
---

1 在jsp指定位置（某个div处）生成工具条  
 jsp页面：

.query{  
   background-image:url(../images/toolBar/application\_form\_find.png) !important;  
}  
&lt;div id="toolBar" class="x-toolbar"&gt;&lt;/div&gt;

 

&lt;script&gt;

  var indexFun = function(){

    return{

          query: function(){

            

          },

          insert: function(){

 

         },

         update: function(){

 

         },

         download: function(){

 

         }

    }

  }();

&lt;/script&gt;

&lt;script&gt;  
 Ext.QuickTips.init();  //提示信息  
 /\**  
  * 初始化ext工具条  
 \*/  
function initToolBar(){  
var toolbar = new Ext.Toolbar({  
   applyTo: 'toolBar',  
   items: [{  
    text: '查询',  
    tooltip: '查询',  
    iconCls: 'query',  //这里的query为css class类名  
    handler: indexFun.query  
   },'-',{  
    text: '新增',  
    tooltip: '新增',  
    iconCls: 'add',  
    handler: indexFun.insert  
   },'-',{  
    text: '修改',  
    tooltip: '修改',  
    iconCls: 'update',  
    handler: indexFun.update  
   },'-',{  
    text: '导出',  
    tooltip: '导出',  
    iconCls: 'download',  
    handler: indexFun.download  
   }]  
  });  
 }

 //初始化         
 Ext.onReady(function(){  
  initToolBar();  
 });  
&lt;/script&gt;