Este codigo javascript, nos muestra como mover el Background de nuestra pagina.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<html> <head> <title>Javascript Moving Background</title> </head> <body background="backold.gif"> <script language="JavaScript" type="text/javascript"> <!-- // please keep these lines on when you copy the source // made by: Nicolas - http://www.javascript-page.com var background = "ejemplos/bisco.gif"; var speed = 0; browserName = navigator.appName; browserVer = parseInt(navigator.appVersion); if (browserName != "Netscape" || browserVer >= 4.5) { function moveback(movert,movedn,hPos,vPos) { if (arguments[4]) document.body.style.backgroundImage = "url(\"" + arguments[4] + "\")"; if (arguments[5]) document.body.style.backgroundRepeat = arguments[5] if (!isNaN(hPos)) { if ((movert!=0) && (hPos>0)) hPos=-100000 hPos += movert } if (!isNaN(vPos)) { if ((movedn!=0) && (vPos>0)) vPos=-100000 vPos+= movedn } document.body.style.backgroundPosition= hPos + " " + vPos if (isNaN(hPos)) hPos = "\"" + hPos + "\"" if (isNaN(vPos)) vPos = "\"" + vPos + "\"" setTimeout("moveback("+movert+","+movedn+","+hPos+","+vPos+")",speed) } moveback(1,1,0,0, background); } //--> </script> </FONT> </BODY> </HTML> |