By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

innerHTML javascript events not firing

P: n/a
teb
Hello all,

Here is basically the situation. I have an empty div on my page.
When I mouseover a word, the innerHTML of the div gets written with a
table. The td elements all have onclick, onmouseover, etc. events.
When I mouseover a word, the div appears, but none of the events fire
until another event occurs. For example, if I put in an alert box or
I right click, and then mouseover the div, the td events then work.
Keep in mind that the div is basically acting as a menu. So the
sequence of events that I'm seeing are as follows: mouse over a word,
div appears but none of the events are firing, right click to bring up
std context menu, left click to close, mouseover div again and events
fire.

Here is how I'm setting the innerHTML of the div (I know it could be
cleaner, I'm just testing something).

oContextMenu.innerHTML ='<table width="100" border="0" cellpadding="0"
cellspacing="1" bgcolor="#000000"><tr ><td bgcolor="#cdaf95"
onMouseOut="this.style.background=\'#F7F7F7\';hide Menu();"
onClick="setValue();hideMenu();" onMouseOver="this.style.background
=\'#E8E8E8\';this.style.cursor = \'hand\';">blah</td></tr></table>';

Any help would be appreciated.

teb
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try using _return true_...

Just a thought

Ranbir
In article <67**************************@posting.google.com >, Teb wrote:

Here is basically the situation. I have an empty div on my page.
When I mouseover a word, the innerHTML of the div gets written with a
table. The td elements all have onclick, onmouseover, etc. events.
When I mouseover a word, the div appears, but none of the events fire
until another event occurs. For example, if I put in an alert box or
I right click, and then mouseover the div, the td events then work.
Keep in mind that the div is basically acting as a menu. So the
sequence of events that I'm seeing are as follows: mouse over a word,
div appears but none of the events are firing, right click to bring up
std context menu, left click to close, mouseover div again and events
fire.

Here is how I'm setting the innerHTML of the div (I know it could be
cleaner, I'm just testing something).

oContextMenu.innerHTML ='<table width="100" border="0" cellpadding="0"
cellspacing="1" bgcolor="#000000"><tr ><td bgcolor="#cdaf95"
onMouseOut="this.style.background=\'#F7F7F7\';hide Menu();"
onClick="setValue();hideMenu();" onMouseOver="this.style.background
=\'#E8E8E8\';this.style.cursor = \'hand\';">blah</td></tr></table>';



Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.