Jump to content
xisto Community

sanweikui

Members
  • Content Count

    54
  • Joined

  • Last visited

Everything posted by sanweikui

  1. [br]<script language="JavaScript">[/br]<!----[br]var x = 5 [/br]var y = 5 [br]var change = 10 [/br]var img, img_top,img_left[br][/br]function move(){[br]if(document.layers)[/br]{[br]img = eval("document.image")[/br]img.top = img.top + x[br]img.left = img.left + y[/br]if(img_top >= window.innerHeight) x = -x[br]if(img_left >= window.innerWidth) y= -y[/br]if(img_top <= 0) x = 5[br]if(img_left <= 0) y = 5[/br]}[br][/br]else [br]{[/br]img = eval("image.style")[br]img.posTop = img.posTop + x[/br]img.posLeft = img.posLeft + y[br]img_top = img.posTop[/br]img_left = img.posLeft[br]if(img_top >= document.body.clientHeight) x = -x[/br]if(img_left >= document.body.clientWidth) y= -y[br]if(img_top <= 0) x = 5[br]if(img_left <= 0) y = 5[/br]}[br][/br]SetTimeout("move()", change) }[/br]//---->[br]</SCRIPT>[/br] method: 1.put the code between <body> and </body> 2.change these to yours var x = 5 //horizontal distance var y = 5 //vertical distance var change = 10 //time to change,more big more slower 3.use these codes to refers to your javescript between <body> and </body> <DIV id="image" style="position: absolute;"> <img src="move.gif" alt="moving gif"> </DIV> 4.rewrite your <body> like this: <BODY onload="setTimeout('move()', 10)"> then,enjoy!
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.