All pastes #1478481 Raw Edit

OOP Javascript Fun

public javascript v1 · immutable
#1478481 ·published 2009-06-29 16:04 UTC
rendered paste body
/** * 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());