W
webgour
Hello,
I'm having difficulty using attachEvent instead of simply assigning to
mouseover in my object Sample03. When i use myImage.onmouseover =
this.showmouseover(); in the following all works fine, if I replace it by
myImage.attachEvent('onmouseover',this.showmouseover()); I get for the
alert(this.id) "undefined" and not "gwlogo"
<html>
<head>
</head>
<SCRIPT language="javascript" type="text/javascript">
var Sample03 = function(){
this.Property01 = "Prop01";
var myImage = document.getElementById("gwlogo");
myImage.onmouseover = this.showmouseover();
//myImage.attachEvent('onmouseover',this.showmouseover());
}
Sample03.prototype.showmouseover = function()
{
var _this = this;
return(
function(e){
alert(this.id);
alert(_this.Property01);
})
}
window.onload=function(){
var mySample = new Sample03();
}
</SCRIPT>
<body>
<img src="http://localhost/winxp.gif" id="gwlogo">
</body>
</html>
Thank you for your assistance.
I'm having difficulty using attachEvent instead of simply assigning to
mouseover in my object Sample03. When i use myImage.onmouseover =
this.showmouseover(); in the following all works fine, if I replace it by
myImage.attachEvent('onmouseover',this.showmouseover()); I get for the
alert(this.id) "undefined" and not "gwlogo"
<html>
<head>
</head>
<SCRIPT language="javascript" type="text/javascript">
var Sample03 = function(){
this.Property01 = "Prop01";
var myImage = document.getElementById("gwlogo");
myImage.onmouseover = this.showmouseover();
//myImage.attachEvent('onmouseover',this.showmouseover());
}
Sample03.prototype.showmouseover = function()
{
var _this = this;
return(
function(e){
alert(this.id);
alert(_this.Property01);
})
}
window.onload=function(){
var mySample = new Sample03();
}
</SCRIPT>
<body>
<img src="http://localhost/winxp.gif" id="gwlogo">
</body>
</html>
Thank you for your assistance.