Tengo la siguiente función:
Código :
<script language="javascript" type="text/javascript">
<!--
function GoTop() {
window.scrollTo(0,0);
}
function GoTop_Call() {
document.body.ondblclick = Top;
}
var Xpos = 0;
var Ypos = 0;
var Ygravity = 0.79;
var scrollPos = 0;
var oldScrollPos = 0;
var top_temp=0;
function FloatMenu() {
docWidth = document.body.clientWidth; // Update document width
docHeight = document.body.clientHeight; // Update document height
oldScrollPos = scrollPos;
scrollPos = document.body.scrollTop; // Update scrollbar position
//Xpos = 905;
Xpos = (docWidth - document.getElementById("floater").offsetWidth) - 10;
//Xpos = (docWidth / 2) + 410;
Yboundary = ((scrollPos + docHeight) - document.getElementById("floater").offsetHeight) - 80;
if (document.getElementById("floater").offsetTop < Yboundary - 1) // Object is behind boundary
Ypos += 2;
if (document.getElementById("floater").offsetTop > Yboundary + 1) // Object is past boundary
Ypos -= 1;
Ypos *= Ygravity; // Slow object down
document.getElementById("floater").style.left = Xpos;
//document.getElementById("floater").style.top += Ypos; // Make object bounce
top_temp = document.getElementById("floater").offsetTop;
top_temp += Ypos;
document.getElementById("floater").style.top = top_temp;
}
window.setInterval("FloatMenu()", 1);
//-->
</script>
<DIV id="floater" style="Z-INDEX:150; VISIBILITY: visible; WIDTH: 25px; POSITION: absolute; HEIGHT: 25px;">
<A onFocus="this.blur()" href="javascript:GoTop();" target="_top"><IMG src="/ximages/icoTop.gif" border=0 width="26" height="24"></A></DIV>
con este DOCTYPE:
Código :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
funciona... con este otro no:
Código :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
uso el segundo en todos mis proyectos. por qué no funciona?
El efecto sería el del botón top que se ve en esta página: http://www.integrat.com.ar/ncomputing/exito.html. El botón TOP se mueve según se scrollee y rebota, aparte de subir al top.
una ayudita por favor.
Se agradece...
