This is a piece of code I found and I'm not sure how to modify it for what I need to do:
I'm not sure if this board formats html, so I put xmp tags on, this script moves the picture around in the upper left corner of the page, I need the picture to move down a colum of a table, how should I modify this code, or would it be better just to start over from scratch?
thanks for any help - Greg
I'm not sure if this board formats html, so I put xmp tags on, this script moves the picture around in the upper left corner of the page, I need the picture to move down a colum of a table, how should I modify this code, or would it be better just to start over from scratch?
Code:
<xmp>
<SCRIPT TYPE="TEXT/JAVASCRIPT" LANGUAGE=JAVASCRIPT>
<!-- Hide script from older browsers
firstTime = true
function moveIt() {
if (firstTime) {
if (document.all) {
maxHeight = document.body.clientHeight-40
maxWidth = document.body.clientWidth-40
}
else {
maxHeight = window.innerHeight-40
maxWidth = window.innerWidth-40
}
firstTime = false
}
if (document.all) {
topPos = document.all.mover.style.pixelTop
leftPos = document.all.mover.style.pixelLeft
}
else {
topPos = document.mover.top
leftPos = document.mover.left
}
chgXBy = Math.floor(Math.random() * 10)
if ((halfChance() || topPos >= maxHeight) && topPos > 5) {
topPos -= chgXBy
}
else {
topPos += chgXBy
}
chgYBy = Math.floor(Math.random() * 10)
if ((halfChance() || leftPos >= maxWidth) && leftPos > 5) {
leftPos -= chgYBy
}
else {
leftPos += chgYBy
}
if (document.all) {
document.all.mover.style.pixelTop = topPos
document.all.mover.style.pixelLeft = leftPos
}
else {
document.mover.top = topPos
document.mover.left = leftPos
}
setTimeout("moveIt()",20)
}
function halfChance() {
if (Math.random() < .5) {
return true
}
return false
}
// End hiding script -->
</SCRIPT>
<STYLE TYPE="TEXT/CSS">
#mover {position: absolute; left: 5; top: 5;}
</STYLE>
</HEAD>
<BODY BGCOLOR=WHITE onLoad="moveIt()">
<DIV ID="mover">
<IMG SRC="images/butterfly.gif" WIDTH=32 HEIGHT=32>
</DIV>
</xmp>
thanks for any help - Greg