Get IFRAME xy coordinate in Mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmitMittal
    New Member
    • Jun 2007
    • 2

    Get IFRAME xy coordinate in Mozilla

    I want iframe xy coordinate using mozilla, when i execute my code into IE, it returning me proper x & y coordinate but in mozilla it returns me zero of X & Y.

    Thanks in Advance
    Amit Mittal
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by AmitMittal
    I want iframe xy coordinate using mozilla, when i execute my code into IE, it returning me proper x & y coordinate but in mozilla it returns me zero of X & Y.

    Thanks in Advance
    Amit Mittal
    Welcome to TSDN.

    What is ur code run in IE.
    Plz show us.

    Kind regards,
    Dmjpro.

    Comment

    • AmitMittal
      New Member
      • Jun 2007
      • 2

      #3
      There are two functions that returns me Left & Top coordinate of iframe in IE, But not in any ohter Browser...

      function findPosCurleft( obj)
      {
      var curleft=0;
      //alert('obj' + obj);
      if(obj!=null)
      {
      if(obj.offsetPa rent)
      {
      //alert('obj.offs etParent' + obj.offsetParen t);
      curleft=obj.off setLeft;
      //alert('curleft' + curleft);
      while(obj=obj.o ffsetParent)
      {
      curleft+=obj.of fsetLeft;
      //alert('curleft + ' + curleft);
      }
      }
      }
      //alert('return curleft ' + curleft);
      return curleft;
      }
      function findPosCurtop(o bj)
      {
      var curtop=0;
      if(obj!=null)
      {
      if(obj.offsetPa rent)
      {
      curtop=obj.offs etTop;
      while(obj=obj.o ffsetParent)
      {
      curtop+=obj.off setTop;
      }
      }
      }
      //alert('return curtop ' + curtop);
      return curtop;
      }

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Have you seen this page? I assume you ave looking at your code. Does it work with other elements?

        Comment

        Working...