home *** CD-ROM | disk | FTP | other *** search
INI File | 2006-09-13 | 2.1 KB | 127 lines |
- [SUBJECT]
- Description=Move images and objects across the screen by simply using keys from the keyboard
- ImageIndex=-1
- Folder=Graphical Effects
-
-
- [HEAD_TEXT]
- ;<!-- Original: Massimo Giari (motore@iol.it) -->
- ;
- ;<!-- This script and many more are available free online at -->
- ;<!-- The JavaScript Source!! http://javascript.internet.com -->
- ;
- ;<script language="JavaScript">
- ;<!-- Begin
- ; var ieKey, nKey;
- ;n = (document.layers) ? 1 : 0;
- ;ie = (document.all) ? 1 : 0;
- ;function moveImage() {
- ;if (n) {
- ;block = document.blockDiv;
- ;}
- ;if (ie) {
- ;block = blockDiv.style;
- ;}
- ;block.xpos = parseInt(block.left);
- ;block.active = 0;
- ;document.onkeydown = keyDown;
- ;document.onkeyup = keyUp;
- ;if (n) {
- ;document.captureEvents(Event.keydown | Event.keyup);
- ; }
- ;}
- ;function keyDown(e) {
- ;if (n) {
- ;nKey = e.which;
- ;ieKey = 0;
- ;}
- ;if (ie) {
- ;ieKey = event.keyCode;
- ;nKey = 0;
- ;}
- ;if ((nKey == 97 || ieKey == 65) && !block.active) {
- ;block.active = 1;
- ;slideLeft();
- ;}
- ;if ((nKey == 100 || ieKey == 68) && !block.active) {
- ;block.active = 1;
- ;slideRight();
- ; }
- ;}
- ;function keyUp(e) {
- ;if (n) {
- ;nKey = e.which;
- ;ieKey = 0;
- ;}
- ;if (ie) {
- ;ieKey = event.keyCode;
- ;nKey = 0;
- ;}
- ;if ((nKey == 97 || ieKey == 65 || nKey == 100 || ieKey == 68))
- ;block.active = 0;
- ;}
- ;function slideRight() {
- ;if (block.active) {
- ;block.xpos += 5;
- ;block.left = block.xpos;
- ;status = block.xpos;
- ;setTimeout("slideRight()", 25);
- ; }
- ;}
- ;function slideLeft() {
- ;if (block.active) {
- ;block.xpos -= 5;
- ;block.left = block.xpos;
- ;status = block.xpos;
- ;setTimeout("slideLeft()", 25);
- ; }
- ;}
- ;// End -->
- ;</script>
-
-
-
-
- [BODY_TAG]
- ;onLoad="moveImage()"
-
-
-
- [BODY_TEXT]
- ;<div id="blockDiv" STYLE="position:absolute; left:`left`px; top:`top`px; width:`width`px; height:`height`px">
- ;<img src="`image`" alt=""></div>
- ;
- ;Use <b>A</b> to move the image toward left, <b>D</b> to move the image right.
-
-
-
-
- [`image`]
- Kind=U
- Value=image1.gif
-
-
-
- [`left`]
- Kind=N
- Value=317
-
-
-
- [`top`]
- Kind=N
- Value=130
-
-
-
- [`width`]
- Kind=N
- Value=137
-
-
- [`height`]
- Kind=N
- Value=121
-
-
-