全部文本 #1478481 原始 编辑

OOP Javascript Fun

公开 javascript v1 · 不可变
·已发布 2009-06-29 16:04 UTC
渲染后的文本正文
/** * Body data of a Modal Dialog Box * all setters are chainable. *  * @author Jeff O'Toole */var DialogContent = function() {		/**	 * Allows this object to play nicely with jQuerys $(this) context object	 */	var self = this;		/**	 * Content Properties	 */	this.title;	this.content;		/**	 * Sets the Title property	 * @param title string	 * @return DialogContent	 */	this.setTitle = function(title) {		self.title = title;		return self;	}		/**	 * Gets the Title Property	 */	this.getTitle = function() {		return self.title;	}	/**	 * Sets the Content property	 * @param content string	 * @return DialogContent	 */		this.setContent = function(content) {		self.content = content;		return self;	}		/**	 * Gets the Content Property	 */	this.getContent = function() {		return self.content;	}}// Build Dialog Contentvar dialogContent = new DialogContent();// Load ObjectdialogContent.setTitle("COOL")             .setContent("NEATO");// Test Objectalert(dialogContent.getContent() + ' ' + dialogContent.getTitle());