Metachecker.net
|
TrafficChecker.net
|
RankChecker.net
Learn Java Script Today
|
Over 5000 Free Fonts
|
Tutorials
|
Javascript Forum
|
Other Javascript Resources
|
Cheat Sheet
JavaScript Basics
Inserting Javascript
Complete Tutorial
Advance DHTML Tutorial
Script archive
Advanced Tutorials
Alert Scripts
Animation
Audio
Background Effects
Banner Ads
Browser Window
Buttons
Button Forms
Calculcators
Calendars
Clocks & Dates
Cookies
Cursor Effects
DHMTL Games
DHTML Miscellaneous
Equivalents
Forms
Games
IE4+ Scripts
IE5+ Scripts
Image Effects
Image Miscellaneous
Links & Buttons
Math Related
Messages Miscellaneous
Miscellaneous
Mouse Tricks
Navigation
Page Details
Password Protection
Pulldown Menus
Random Stuff
Scrolling
Status Bar
Text Animation
User Detail
User Info
Window Control
Flying Image Script
This script demonstrates the use of VBscript to create a DHTML script that flys a relatively-positioned image straightly across the screen. JavaScript isn't the only path to DHTML's heart, you know :-)
Insert into <HEAD>
Insert into <BODY>
<body onload="Ypick()"> <script language="VBScript"> on error resume next if parent.navButtonStatus <> 3 then if err.number <> 0 then call parent.ThereIsAnError end if end if </script> <script language="JavaScript"> /* Flying Image Script- By Dylan Coldblatt (codeboy14@yahoo.com) Submitted to Dynamicdrive.com for featuring in it's archive */ var yend; var ystart; var ydiff; var xincrement; var yincrement; var screenwidth; var screenheight; function Ypick(){ if (!document.all) return screenwidth = screensize.offsetWidth; screenheight = screensize.offsetHeight; xincrement = (screenwidth/10); ystart = Math.round(Math.random()*(screenheight-92)); yend = Math.round(Math.random()*(screenheight-92)); document.all.ball.style.top=ystart; document.all.ball.style.left=-100; if (ystart > yend){ ydiff = (ystart-yend); yincrement = (ydiff/xincrement); Moveneg(); } else { ydiff = (yend-ystart); yincrement = (ydiff/xincrement); Movepos(); } } function Moveneg(){ if (screenwidth > parseInt(document.all.ball.style.left)) { with (document.all.ball) { style.left = parseInt(style.pixelLeft + 10); style.top = parseInt(style.pixelTop - yincrement); } setTimeout('Moveneg()',20); } else { with (document.all.ball) { style.left = parseInt(style.pixelLeft - screenwidth); style.top = parseInt(style.pixelTop - yend); } Ypick(); } } function Movepos(){ if (screenwidth > parseInt(document.all.ball.style.left)) { with (document.all.ball) { style.left = parseInt(style.pixelLeft + 10); style.top = parseInt(style.pixelTop + yincrement); } setTimeout('Movepos()',20); } else { with (document.all.ball) { style.left = parseInt(style.pixelLeft - screenwidth); style.top = parseInt(style.pixelTop - yend); } Ypick(); } } </script> <div id="screensize" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%"></div> <p><img id="ball" SRC="http://dynamicdrive.com/plane.gif" style="container:in-flow;position:relative;left:-100;top:0;visibility:show">
Other Options
Step 2: Finally, add the following event handler to your <body> tag, like below: <body onload="Ypick()">