navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Concerning Event Handlers

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> Concerning Event Handlers
Page: [1]
 
aaronfjerstad

 

Posts: 8
Joined: 5/30/2008
Status: offline

 
Concerning Event Handlers - 6/3/2008 17:00:28   
I am having a problem reguarding the assignment of event handlers. My code creates a box 10 pixels above and to the left of the point clicked on a DIV. This works fine. The problem occurs when I attempt to assign an event handler to the onMouseOut event of the newly created DIV. Can anyone help me?

Here is the isolated code:

<style>
div.myDiv
{
width:200;
height:200;
overflow:hidden;
background:rgb(0,122,122);
}

div.menuDiv
{
width:100;
height:50;
background:rgb(255,0,0);
position:absolute;
}
</style>
<script>
var posx, posy, menuDiv;
function menu()
{
posx = event.x;
posy = event.y;
menuDiv = document.createElement('div');
menuDiv.className = "menuDiv";
menuDiv.style.top = posy - 10;
menuDiv.style.left = posx - 10;

<!---Offending Code---!>
menuDiv.setAttribute("onMouseOut", "closeMenu()"); <!---This should cause the DIV to close.---!>
<!---End Offending Code---!>

menuDiv = document.getElementById('myDiv').appendChild(menuDiv);
}

function closeMenu()
{
menuDiv.innerHTML = "";
menuDiv.removeNode();
}
</script>

<div onClick = "menu()" id = "myDiv" name = "myDiv" class = "myDiv"><br></div>

< Message edited by aaronfjerstad -- 6/3/2008 17:31:57 >
jaybee

 

Posts: 14157
Joined: 10/7/2003
From: Berkshire, UK
Status: offline

 
RE: Concerning Event Handlers - 6/8/2008 5:36:52   
What exactly are you trying to do? Expand and contract menus?

_____________________________

If it ain't broke..... fix it until it is.
:)

:)
GAWDS
Now where did I put that Doctype?

(in reply to aaronfjerstad)
aaronfjerstad

 

Posts: 8
Joined: 5/30/2008
Status: offline

 
RE: Concerning Event Handlers - 6/9/2008 0:27:09   
That is essentially the idea. I am trying to add menu function to a fluid layout. This was the solution that I devised. Unfortunately, I have not been able to force the closure of the menu upon exit.

(in reply to jaybee)
Page:   [1]

All Forums >> Web Development >> General Web Development >> Concerning Event Handlers
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts