<body OnLoad="setOB();focus()"> <script language="JavaScript"> <!-- var key=0 var xxfunction setOB(){ n = (document.layers) ? 1 : 0; X = (n)? document.ppkoabcd : ppkoabcd.style Xpos = parseInt(X.left); Ypos = parseInt(X.top); document.onkeydown = keyDown; document.onkeyup = keyUp; if (n) document.captureEvents(Event.keydown | Event.keyup); } function keyDown(e) { key = (n)? e.which : event.keyCode if (key == 108 || key == 37) m(1,2); if (key == 114 || key == 39) m(1,3); if (key == 100 || key == 40) m(1,4); if (key == 117 || key == 38) m(1,5); } function keyUp(e) { key=0;clearTimeout(xx); } function m(t,u) { clearTimeout(xx) if (t==1){ if (u==2){X.left = Xpos-=5;xx = setTimeout("m(1,2)", 40);} if (u==3){X.left = Xpos+=5;xx = setTimeout("m(1,3)", 40);} if (u==4){X.top = Ypos+=5;xx = setTimeout("m(1,4)", 40);} if (u==5){X.top = Ypos-=5;xx = setTimeout("m(1,5)", 40);} } } //--> </script> <div id="ppkoabcd" style="position:absolute; left:0px; top:100px;"> <img src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081123451490.jpg"> </div> |