Hi,

I am trying to make a round corners script in object oriented programming method. This is purely for learning purposes.

The script is no where near complete but I am already having problems with it.

I am trying out the techniques described in 'David Flanagan ' text book 'JavaScript: The Definitive Guide, 5th Edition'

This code is called from html page which once working will place a round container around element

Code:
Factory_rounded_corners("content", "#507742", "all_round");
/* content is id of element
* #507742 is color to be applied
* all_round means round corners will be applied on top and bottom of element
* one means only one element is to be affected
*/


**************Javascript functions below *******************
Code:
/* Function	Factory_rounded_corners
*	-------------------------
*	Parameter: selector
*	Return: None
*	Description: Create a rounded container around elements to be affected
*/
function Factory_rounded_corners(selector, color, type, numb_elem)
{
	var rounded_container;
	if(numb_elem == "one" && type == "all_round")
	{
                rounded_container = new All_rounded_corners_one_element(selector, color);
		alert(rounded_container.color);//works
		rounded_container.elements_to_be_affected()//Does not work
 
	}
}

/* Function	All_rounded_corners_one_element
*	-------------------------
*	Parameter: selector
*	Return: None
*	Description: Create a rounded container around elements to be affected
*/
function All_rounded_corners_one_element(selector, color)
{
	alert("Inside All_rounded_corners");
	this.superclass(selector, color); // works
	//Custom_rounded_container.call(this, selector, color);
}
*	Function custom_rounded_container
*	----------------------------------
*	Parameters: selector
*	Properties: this.temp_array
*	Methods: this.elements_to_be_affected, this.apply
*	Returns: Returns a object 
*	Description: 
*/
function Custom_rounded_container(selector, color)
{
	alert("Inside Custom_rounded_container"); // works
	this.temp_array = selector.split(" ");
	this.color = color;
	//alert(this.temp_array);
}

/*	Function elements_to_be_affected
*	----------------------------------
*	Parameters: None
*	Properties: None
*	Local variables:	None 
*	Local methods: None
*	Returns: elements in array or one element
*	Description: Retrieves elements to be affected
*/
Custom_rounded_container.prototype.elements_to_be_affected = function()
{
	alert("Inside elements_to_be_affected");//DOES NOT WORK
}
All_rounded_corners_one_element.prototype.superclass = Custom_rounded_container;
All_rounded_corners_one_element.prototype  = new Custom_rounded_container();
If anyone has a better idea of how to do this, please let me know.

Thankyou

Shippuuden