views:

19

answers:

1

Hi

I have a Tooltip which on mouse over opens on the top left side corner of the page irrespectve of the 'mouseover'. In case of IE8 this works fine and opens just above the place where mouse is placed but in Firefox its unable to calculate/interprete the values.

here is the code snippet for tooltip

   function DoFlyOver()
{
  if( ToClear != -1 ) window.clearTimeout( ToClear );
  var thisForm = eval("document." + formName);
  if (FlyOverArea == null) FlyOverArea = document.getElementById("FlyOverArea");

    if (FlyOverArea.firstChild!==null)
        FlyOverArea.removeChild(FlyOverArea.firstChild); // remove all existing content
        FlyOverArea.appendChild(document.createTextNode(FoText));

    FoLeft = $displayOptions.getFlyoverLeftOfCursor();
        FoTop = $displayOptions.getFlyoverTopOfCursor();
    FlyOverArea.style.left = Number(thisForm.mousex.value) + Number(thisForm.scrollx.value) - Number(FoLeft);  
    FlyOverArea.style.top = Number(thisForm.mousey.value) + Number(thisForm.scrolly.value) - Number(FoTop);
    var maxX = (window.screen.width * $displayOptions.getFlyoverThreshold())/100;

// If the mouse is at the extreme right corner the max threshold should the tooltip be //placed.
   if(FlyOverArea.style.posLeft > (window.screen.width - maxX)){

    FlyOverArea.style.left = window.screen.width - maxX;
   }
    FlyOverArea.style.display = "";
    ToClear = setTimeout( "ClearFlyOver()", $displayOptions.getFlyoverVisibleTimeWithCursor(), "JAVASCRIPT" );//set timeout
}

    <DIV ID=FlyOverArea CLASS="FO" STYLE="display: none">
     </DIV> 

I suspect its wih style.top and style.left and tried with style.pixelLeft,style.posleft too but no use

A: 

Ha I found the answer,Mozilla cannot recognizes numbers but if you append with px it will set the position. For example

var theLeft=Number(thisForm.mousex.value) + Number(thisForm.scrollx.value) - Number(FoLeft);
FlyOverArea.style.left = theLeft+"px"

This solved the problem

GustlyWind