Template:UseFloats: Difference between revisions

Template page
mNo edit summary
mNo edit summary
Line 3: Line 3:
<script type="text/javascript">
<script type="text/javascript">
   var useFloats = true;
   var useFloats = true;
  function findRelPosX(obj) {
    var relleft = 0;
    if (obj.offsetParent) {
      relleft = obj.offsetLeft;
    } else if (obj.x) {
      relleft = obj.x;
    }
    return relleft;
  }


   function findPosX(obj)
   function findPosX(obj)
Line 10: Line 22:
   if (obj.offsetParent)
   if (obj.offsetParent)
   {
   {
                return obj.offsetLeft;
           
   while (obj.offsetParent)
   while (obj.offsetParent)
   {
   {

Revision as of 16:32, 28 June 2006

<plainhtml>

<script type="text/javascript">

 var useFloats = true;
 function findRelPosX(obj) {
   var relleft = 0;
   if (obj.offsetParent) {
     relleft = obj.offsetLeft;
   } else if (obj.x) {
     relleft = obj.x;
   }
   return relleft;
 }
 function findPosX(obj)
 {
 	var curleft = 0;
 	if (obj.offsetParent)
 	{
 		while (obj.offsetParent)
 		{
 			curleft += obj.offsetLeft
 			obj = obj.offsetParent;
 		}
 	}
 	else if (obj.x)
 		curleft += obj.x;
 	return curleft;
 }
 
 function findPosY(obj)
 {
 	var curtop = 0;
 	if (obj.offsetParent)
 	{
 		while (obj.offsetParent)
 		{
 			curtop += obj.offsetTop
 			obj = obj.offsetParent;
 		}
 	}
 	else if (obj.y)
 		curtop += obj.y;
 	return curtop;
 }

</script>

</plainhtml>