chucuoi
12-12-2003, 09:44 PM
My example to make a rectangle, and it's background is Blue.
I want to build a MouseOut Event for the Rectangle, This Event performing the task: when I move Mouse out of the Rectangle, the Rectangle will Invisible. (This action will use to build a Drop Down Menu...). But My code contains an Error that i can't repair it. Can you help me Step by Step... Thank you very much!
The Error : "Object dosen't suport this property or method"
After Debug by Microsoft Enviroment, it show me these line:
function anonymous() {
menu1.outHandle();return false;
}
Here is my Code:
(I run my code on IE6, my Computer uses WindowsXP and Internet Information Services (IIS) are installed on my Computer. )
<HTML>
<Title>Simple Example </Title>
<Head></Head>
<Body>
<Script language = "JavaScript">
function MEvenInit()
{
document.all[this.vname].onmouseout= new Function(this.vname + ".outHandle();return false;");
}
function Mout()
{
document.all[this.vname].style.visibility="hidden";
}
function MWriteDIV()
{
document.write("<DIV ID =" + this.vname + "></DIV>")
}
function MWriteCSS()
{
document.write("<Style type = 'text/css'>");
document.write("#" + this.vname + "{position : absolute;background-color:blue;width :" + this.W + ";height:" + this.H + ";cursor : hand;visibility: visible}");
document.write("</Style>");
}
function Menu(id,vname,link,W,H)
{
this.ID=id;
this.vname=vname;
this.link=link;
this.W=W+ "px" ;
this.H=H+ "px";
this.outHandle=Mout;
this.WriteCSS=MWriteCSS;
this.EvenInit=MEvenInit;
this.WriteDIV=MWriteDIV;
}
M1 = new Menu(1,"menu1","http://vnexpress.net",50,50);
M1.WriteCSS();
M1.WriteDIV();
M1.EvenInit();
</Script>
<Body>
</HTML>
I want to build a MouseOut Event for the Rectangle, This Event performing the task: when I move Mouse out of the Rectangle, the Rectangle will Invisible. (This action will use to build a Drop Down Menu...). But My code contains an Error that i can't repair it. Can you help me Step by Step... Thank you very much!
The Error : "Object dosen't suport this property or method"
After Debug by Microsoft Enviroment, it show me these line:
function anonymous() {
menu1.outHandle();return false;
}
Here is my Code:
(I run my code on IE6, my Computer uses WindowsXP and Internet Information Services (IIS) are installed on my Computer. )
<HTML>
<Title>Simple Example </Title>
<Head></Head>
<Body>
<Script language = "JavaScript">
function MEvenInit()
{
document.all[this.vname].onmouseout= new Function(this.vname + ".outHandle();return false;");
}
function Mout()
{
document.all[this.vname].style.visibility="hidden";
}
function MWriteDIV()
{
document.write("<DIV ID =" + this.vname + "></DIV>")
}
function MWriteCSS()
{
document.write("<Style type = 'text/css'>");
document.write("#" + this.vname + "{position : absolute;background-color:blue;width :" + this.W + ";height:" + this.H + ";cursor : hand;visibility: visible}");
document.write("</Style>");
}
function Menu(id,vname,link,W,H)
{
this.ID=id;
this.vname=vname;
this.link=link;
this.W=W+ "px" ;
this.H=H+ "px";
this.outHandle=Mout;
this.WriteCSS=MWriteCSS;
this.EvenInit=MEvenInit;
this.WriteDIV=MWriteDIV;
}
M1 = new Menu(1,"menu1","http://vnexpress.net",50,50);
M1.WriteCSS();
M1.WriteDIV();
M1.EvenInit();
</Script>
<Body>
</HTML>