locked
Event not supported in Mozilla RRS feed

  • Question

  • I have following code to generate a transpert pop up for onchange event of drop down

    [CODE]if (xmlHttp.readyState==4)
    {
     /* get the mouse left position */
     var x = [B]event[/B].clientX + document.body.scrollTop + 360; // LINE 1
     /* get the mouse top position */
     var y = [B]event[/B].clientY + document.body.scrollTop + 330; // LINE 2
     /* display the pop-up */
     
     /* set the pop-up's left */
     Popup.style.left = x;
     /* set the pop-up's top */
     Popup.style.top = y;
     Popup.style.display="block";
     document.getElementById("Popup").innerHTML=xmlHttp.responseText;[/CODE]

    Above code works fine for IE but in MOzilla it gives error "EVENT is not defined"
    Please note: LINE 1 and LINE 2 are used to adjust position of window. If I remove it code works fine for all browsers but does not have a position that I want.

    Please help

    Tuesday, January 12, 2010 3:16 PM

All replies

  • Hi,


    Pass "event" as a parameter to the function where you have written the script
    eg:
    function OnChangeEvent(evt)
    {
    ....
    ....
    if (xmlHttp.readyState==4)
    {
     /* get the mouse left position */
     var x = [B]evt[/B].clientX + document.body.scrollTop + 360; // LINE 1
     /* get the mouse top position */
     var y = [B]evt[/B].clientY + document.body.scrollTop + 330; // LINE 2
     /* display the pop-up */
     
     /* set the pop-up's left */
     Popup.style.left = x;
     /* set the pop-up's top */
     Popup.style.top = y;
     Popup.style.display="block";
     document.getElementById("Popup").innerHTML=xmlHttp.responseText;
    ....
    }
    following is the markup for the drop down and the onchange event where you are showing popup.
    <select id="ddlSelect" onchange="OnChange(event);">
    .....
    ....
    ....
    </select>
    

    chandu
    Saturday, January 30, 2010 1:54 PM