A warm Hi to all members to of the Dani Web community!
I am facing a problem with window events in javascript. In my code I am creating an javascript object using a constructor and i have created all its functions using 'prototype' . Here is a sample code
var myObject = new MYObject(param1, param2);
MYObject.prototype.showObject = function(){.......
Now somewhere in my code, i required to add an event handler for the window.onscroll event.
First, i tried by using a member of my object which happens to be a frame as follows :
this.IFrame = document.getElementById('iFrame1');
this.IFrame.parentWindow.onscroll = this.showObject;
but it won't work
then i tried writing an external function as follows:
function callshowObject(){
myObject.showObject();
}
window.onscroll = callshowObject;
this too doesn't work. :mad:
Is there any way by which i can make my object's function the eventhandler for the window's event?
i would be grateful for any help