[Javascript] DOCTYPE making div.style.top NOT WORK

Michael Borchers list at tridemail.de
Thu Dec 14 09:13:36 CST 2006


sorry, the script works for an intranet, cannot post the url.
but the problem should show up with the script  I changed  below:

>
>
> the script:
>
> ---------------------------------------------------------------------------------------------------------------------
>
> <html>
>
> <head>
> <title>JavaScript</title>
>
> <script type="text/javascript">
> function getPosition(element)
> {
>  var elem=element,tagname="",x=0,y=0;
>
>  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined"))
>  {
>    y+=elem.offsetTop;
>    x+=elem.offsetLeft;
>    tagname=elem.tagName.toUpperCase();
>
>    if (tagname=="BODY")
>      elem=0;
>
>    if (typeof(elem)=="object")
>      if (typeof(elem.offsetParent)=="object")
>        elem=elem.offsetParent;
>  }
>
>  position=new Object();
>  position.x=x;
>  position.y=y;
>  return position;
> }
>
>
> function getSort(elementId, divId, show)
> {
>  var a,element;
>
>  element=document.getElementById(elementId);
>  div=document.getElementById(divId);
>
>  a=getPosition(element);
>
>   if(show == true)
>   {
>    div.style.visibility = 'visible';
>    div.style.display  = 'block';
>
>    div.style.top  = a.x+58;
>    div.style.left = a.y+20;
>  }
>  else
>  {
>    div.style.visibility = 'hidden';
>    div.style.display  = 'none';
>  }
> }
>
>
> function handleSort(elementId, divId, show)
> {
>  var a,element;
>
>  element=document.getElementById(elementId);
>
>  div=document.getElementById(divId);
>
>  a=getPosition(element);
>
>  if(show == true)
>  {
>   div.style.top  = a.x+58;
>   div.style.left = a.y+20;
>
>   div.style.visibility = 'visible';
>   div.style.display  = 'block';
> }
> else
> {
>   div.style.visibility = 'hidden';
>   div.style.display  = 'none';
> }
> }
> </script>
> </head>
>
> <body>
>
> <a onmouseover="javascript:handleSort(this.id, 'sortDiv', true)" 
> name="sort[contacts.contacts_name]" 
> id="sort[contacts.contacts_name]">12345</a>
>
> <div id="sortDiv" 
> style="display:none;visibility:hidden;position:relative;"
onmouseout="javascript:handleSort('sort[contacts.contacts_name]', 'sortDiv', 
false)" >
<a href="#">on mouse over this link the div disappears :(</a>
</div>
>
> </body>
> </html>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript 




More information about the Javascript mailing list