innerHTML javascript events not firing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • teb

    innerHTML javascript events not firing

    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.in nerHTML ='<table width="100" border="0" cellpadding="0"
    cellspacing="1" bgcolor="#00000 0"><tr ><td bgcolor="#cdaf9 5"
    onMouseOut="thi s.style.backgro und=\'#F7F7F7\' ;hideMenu();"
    onClick="setVal ue();hideMenu() ;" onMouseOver="th is.style.backgr ound
    =\'#E8E8E8\';th is.style.cursor = \'hand\';">blah </td></tr></table>';

    Any help would be appreciated.

    teb
  • Ranbir Kaur

    #2
    Re: innerHTML javascript events not firing

    Try using _return true_...

    Just a thought

    Ranbir


    In article <677144a3.04092 12322.551864c3@ posting.google. com>, Teb wrote:

    [color=blue]
    > 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.in nerHTML ='<table width="100" border="0" cellpadding="0"
    > cellspacing="1" bgcolor="#00000 0"><tr ><td bgcolor="#cdaf9 5"
    > onMouseOut="thi s.style.backgro und=\'#F7F7F7\' ;hideMenu();"
    > onClick="setVal ue();hideMenu() ;" onMouseOver="th is.style.backgr ound
    > =\'#E8E8E8\';th is.style.cursor = \'hand\';">blah </td></tr></table>';[/color]




    Comment

    Working...