标签:权限 学习 方法 ide 对象 str func 页面 需要
//(1)根据按钮添加分隔符
/** 查询工具栏中table中的所有td,去掉第一个td与最后一个td */
var table = $("#tb > table");
var tds = table.find("td:not(:first,:last)");
/** 判断td的个数 */
if(tds.length > 0){
/** 创建td添加到所有查询到得td前面(相邻元素) */
$(‘<td><div class="dialog-tool-separator"></div></td>‘)
.insertBefore(tds);
}
//(2)没有一个权限需要把工具栏中table隐藏
if(table.find("td").length == 1){
table.hide();
}
(function($){
/**书写自定义的JQuery方法的位置*/
- })(jQuery);
$.fn.自定义方法的名字 = function(){
- /** 逻辑代码 */
- }
/**
* jQuery工具插件
*/
(function($){
- /**
* 优化表格上面的工具栏插件
* (1)根据按钮添加分隔符
* (2)没有一个权限需要把工具栏中table隐藏
*/
$.fn.formart4ToolBar = function(){
/**
* this:代表调用当前方法的JQuery对象 即$("#tb > table")
*/
//(1)根据按钮添加分隔符
/** 查询工具栏中table中的所有td,去掉第一个td与最后一个td */
var tds = this.find("td:not(:first,:last)");
/** 判断td的个数 */
if(tds.length > 0){
/** 创建td添加到所有查询到得td前面(相邻元素) */
$(‘<td><div class="dialog-tool-separator"></div></td>‘)
.insertBefore(tds);
}
//(2)没有一个权限需要把工具栏中table隐藏
if(this.find("td").length == 1){
this.hide();
}
};
})(jQuery);
//调用自定义的插件来优化页面
$("#tb > table").formart4ToolBar();
标签:权限 学习 方法 ide 对象 str func 页面 需要
原文地址:http://www.cnblogs.com/zeng1994/p/7397577.html