/**
* Author: irfan.ub@gmail.com
* Date: Dec 16, 2010
* Version: 1.0
*
* This class will create button for you.
* You just need to make a div element in body,
* Author: irfan.ub@gmail.com
* Date: Dec 16, 2010
* Version: 1.0
*
* This class will create button for you.
* You just need to make a div element in body,
* then you define the id attribute
*
* @id string id of element
* @width number width of the element in pixel
* @text string text you hope show on button
*/
function JButton(id, width, text){
* @id string id of element
* @width number width of the element in pixel
* @text string text you hope show on button
*/
function JButton(id, width, text){
this.elem = document.getElementById(id);
this.elem.style.border = '1px solid blue';
this.elem.style.width = width;
this.elem.style.textAlign = 'center';
this.elem.style.margin = '0 auto';
this.elem.style.cursor = 'pointer';
this.inner = document.createElement('p');
this.inner.style.backgroundColor = '#af0';
this.inner.style.margin = '1px';
this.inner.style.fontWeight = 'bold';
this.inner.style.color = 'blue';
this.inner.innerHTML = text;
}
JButton.prototype.create = function(){
this.elem.appendChild(this.inner);
}
this.elem.style.border = '1px solid blue';
this.elem.style.width = width;
this.elem.style.textAlign = 'center';
this.elem.style.margin = '0 auto';
this.elem.style.cursor = 'pointer';
this.inner = document.createElement('p');
this.inner.style.backgroundColor = '#af0';
this.inner.style.margin = '1px';
this.inner.style.fontWeight = 'bold';
this.inner.style.color = 'blue';
this.inner.innerHTML = text;
}
JButton.prototype.create = function(){
this.elem.appendChild(this.inner);
}
No comments:
Post a Comment