Hi,

I am trying to learn object oriented javascript and I ran into a problem, which I can't understand. To keep it simple I created a dummy object and then placed everything into one html file, which is below:

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Object Test</title>

<script type="text/javascript">

function ObjectTest()
{
	var height ;
	//CONSTRUCTOR BEGIN
	this.setHeight(250) ;
	
	//CONSTRUCTOR END
	
	//PREVILIGED FUNCTION BEGIN
	this.setHeight = function(aHeight)
	{
		height = aHeight ;
		alert(height) ;
	}
	//PREVILEGED FUNCTION END
}
</script>

</head>

<body>

<script type="text/javascript">
	var myObj = new ObjectTest() ;
	//myObj.setHeight(250) ;
</script>

</body>
</html>
If you try to run this html file, it will create an object of ObjectTest. In the constructor,
Code JavaScript:
this.setHeight(250) ;
line is giving the actual error. I get an error that says this.setHeight is not a function.

But if you comment that line and uncomment
Code JavaScript:
myObj.setHeight(250) ;
inside the body tag, then, everything works fine.

My question is how do I call previleged methods such as setHeight() from the constructor of the javascript object.

Thank you so much in advance for your help.