js玩具——UI组件:边距
2011-09-19 17:04
316 查看
/*
* 边距
* author: 吴安国
* version: 1.0
*/
* 边距
* author: 吴安国
* version: 1.0
*/
function Margin() { switch(arguments.length) { case 0: throw new Error("Margin参数错误"); break; case 1: this.left = this.right = this.top = this.bottom = arguments[0]; break; case 2: this.top = this.bottom = arguments[0]; this.left = this.right = arguments[1]; break; case 3: this.top = arguments[0]; this.left = this.right = arguments[1]; this.bottom = arguments[2]; break; case 4: default: this.top = arguments[0]; this.right = arguments[1]; this.bottom = arguments[2]; this.left = arguments[3]; break; } } /** * 左边边距 * @return left */ Margin.prototype.getLeft = function() { return "'" + this.left + "'"; }; /** * 右边边距 * @return right */ Margin.prototype.getRight = function() { return "'" + this.right + "'"; }; /** * 上边边距 * @return top */ Margin.prototype.getTop = function() { return "'" + this.top + "'"; }; /** * 下边边距 * @return bottom */ Margin.prototype.getBottom = function() { return "'" + this.bottom + "'"; }; Margin.prototype.toString = function() { var sb = new StringBuffer("'"); sb.append(this.top).append(" "); sb.append(this.right).append(" "); sb.append(this.bottom).append(" "); sb.append(this.left).append("'"); return sb.toString(); };
相关文章推荐
- js玩具——UI组件:Image 位图
- js玩具——UI组件:Button 按钮
- js玩具——UI组件:ObjectUtil 工具类
- js玩具——UI组件:颜色
- js玩具——UI组件:HtmlUIUtil htmlui工具类
- js玩具——UI组件:PanelHtmlUI 面板html
- js玩具——UI组件:EventObject 事件对象
- js玩具——UI组件:位置
- js玩具——UI组件: ImageHtmlUI 位图html
- js玩具——UI组件:PropertyChangeEvent 属性改变事件对象
- js玩具——UI组件:规格
- js玩具——UI组件:FrameHtmlUI body html
- js玩具——UI组件:ChildChangeEvent 子元素增删事件对象
- js玩具——UI组件:Pane 面板
- js玩具——UI组件:ContainerUI 容器html
- js玩具——UI组件:PropertyChangeEventListener 属性改变事件监听器及默认实现
- js玩具——UI组件:Frame 页面body
- js玩具——UI组件:ButtonHtmlUI 按钮html
- js玩具——UI组件:ChildChangeEventListener 增删子元素事件监听器接口及默认实现
- js玩具——UI组件: EventCache 事件缓存