Hi Chrissy,
This uses getElementById to move the div, you'll need to check compatibility with
your target browsers. If you have to have your page work with layers you'll have
to post a test link or more source code for us to help you.
You'll have to put your own image in this page of course.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Move Along Little Doggie</title>
<script>
var move_div;
var tm;
var pos;
var screenH = screen.availHeight;
var screenW = screen.availWidth;
var myDog = new Image();
myDog.src = "images/doggie.jpg";
function init(){
move_div = document.getElementById('anim');
move_div.style.top = 200;
pos = -80;
tm = setInterval('moveDiv()',120);
}
function moveDiv(){
if(pos > (screenW + 50)){
clearInterval(tm);
init();
}
move_div.style.visibility = 'visible';
move_div.style.left = pos;
pos += 15;
}
window.onload = init;
</script>
</head>
<body>
<div id="anim" style="left:0; top:0; position: absolute; visibility: hidden;">
<img src="images/doggie.jpg" width="150" height="90" alt="" border="0" align="">
</div>
</body>
</html>
HTH
Lrnmore
|