innerHTML javascript events not firing

T

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\';hideMenu();"
onClick="setValue();hideMenu();" onMouseOver="this.style.background
=\'#E8E8E8\';this.style.cursor = \'hand\';">blah</td></tr></table>';

Any help would be appreciated.

teb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top