problem when use CSS to Creat Popup menu

liunx

Guest
This 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!

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>This actually would be better off in the DHTML forum. I'll work on it for what I'm worth, but definitely post this in the DHTML forum. It doesn't appear that the Cascading Style Sheets are the cause of the problem.
 
Back
Top