# Changing y coordinate of a Floating DIV

**URL:** <https://forum.kirupa.com/t/changing-y-coordinate-of-a-floating-div/223017>\
**Category:** Uncategorized\
**Created:** [April 18, 2007, 7:11pm UTC](https://forum.kirupa.com/t/changing-y-coordinate-of-a-floating-div/223017 "2007-04-18T19:11:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![somnamblst](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@somnamblst](https://forum.kirupa.com/u/somnamblst)\
**Post date:** [April 18, 2007, 7:11pm UTC](https://forum.kirupa.com/t/changing-y-coordinate-of-a-floating-div/223017/1 "2007-04-18T19:11:14Z")

</div>

I have a script that is moving a div down using body onload=“appear();”

For the life of me I can not figure out what is determining the y coordinates. I realize that the top:-250px; determines where the div is prior to floating down. Changing var new\_top = current\_top + 5; doesn’t seem to change anything

```auto
 
<script> 
var timeout; 
function appear(){ 
var the_style = getstyle("floatingflash"); 
if (the_style) { 
var current_top = parseInt(the_style.top); 
var new_top = current_top + 5; 
if (document.layers) { 
the_style.top = new_top; 
} else { 
the_style.top = new_top + "px"; 
} 
if (new_top < 150) { 
the_timeout = setTimeout('appear();',10); 
} 
} 
} // appear 
function disappear() { 
var the_style = getstyle("floatingflash"); 
the_style.display = 'none'; 
} // disappear 
function getstyle(ref) { 
if(document.getElementById && document.getElementById(ref)) { 
return document.getElementById(ref).style; 
} else if (document.all && document.all(ref)) { 
return document.all(ref).style; 
} else if (document.layers && document.layers[ref]) { 
return document.layers[ref]; 
} else { 
return false; 
} 
} // getstyle 
</script> 
 
<div id="floatingflash" style="top:-250px;left:-150px;margin-left:80%; z-index:10;"> 
<a href="javascript:disappear();" style="position:absolute; top:240px; left:290px; font: normal small sans-serif; letter-spacing: 1px; color:white; text-decoration:none; font-size:8pt; height: 5px; z-index:1000;">X</a> 
DIV CONTENT
</div> 

```
