Javascript Image Pop up not working in FF

Discussion in 'JavaScript' started by feeleash, Jan 23, 2007.

  1. #1
    Well here's the javascript:

    <script type="text/javascript">
    function submitenter(myfield)
    {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;

    if (keycode == 13)
    {
    myfield.form.submit();
    return false;
    }
    else
    return true;
    }


    function XY(e)
    {
    x = event.clientX + document.body.scrollLeft;
    y = event.clientY + document.body.scrollTop;
    }

    function ShowMessage(text,id)
    {
    top_pos = y + 20 + 'px';
    left_pos = x - 80 + 'px';
    document.body.insertAdjacentHTML('BeforeEnd', '<DIV STYLE="position:absolute; TOP:' + top_pos + '; LEFT:' + left_pos + ';" ID="' + id + '"><table border=0 bgcolor="#000000" cellpadding=1 cellspacing=0><tr><td>' + text + '</td></tr></table></DIV>');
    }

    function Kill(id)
    {
    id.innerHTML = "";
    id.outerHTML = "";
    }

    </script>

    and here's an exmaple link:

    <A onmouseover="if (window.event) XY(event); ShowMessage('<IMG SRC=images/pics/123.jpg width=150 height=120>', 'popup1')" onmouseout=Kill(popup1) HREF="http://123.com" target="_blank"">123</A>

    It works perfect in IE and Opera but not in FireFox!!! :confused:
     
    feeleash, Jan 23, 2007 IP
  2. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #2
    I believe window.event is an IE only object. You'll need to look for a proper JavaScript event handler
     
    frankcow, Jan 23, 2007 IP