Maybe you want to try:
var balloon = function(){
};
balloon.prototype.iHeight = function(){ return document.getElementById("wrapper").clientHeight; }
Then you can call it later, after the DOM loads.
You need it in a function because otherwise JavaScript will try to calculate the value at definition time.
window.onload = function(){
var oBalloon = new balloon();
var height = oBalloon.iHeight(); // iHeight would be undefined if you tried to calculate it earlier
}
You could just scrap the prototype method altogether and set the property in the onload
handler:
window.onload = function(){
var oBalloon = new balloon();
oBalloon.iHeight = document.getElementById("wrapper").clientHeight;
}
Then, you would only set it once, but also guarantee the DOM will have loaded and the property will be valid by then.
What you had is equivalent to:
var balloon = function(){};
var tmp = document.getElementById("wrapper").clientHeight; // at this point, this is not definted: tmp = undefined
balloon.prototype.iHeight = tmp; // undefined
window.onload = function(){
var oBalloon = new balloon();
}