Moving an Airplane Across a Web Page : Animation : GUI Components : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  GUI Components   » [  Animation  ]   
 



Moving an Airplane Across a Web Page

Please note that some example is only working under IE or Firefox.


/*
Mastering JavaScript, Premium Edition
by James Jaworski 

ISBN:078212819X
Publisher Sybex CopyRight 2001
*/

<html>
<head>
<title>Animation with Divisions</title>
</head>
<script language="JavaScript">
function fly() {
 if(document.getElementById) {
  var planeStyle = document.getElementById("plane").style
  window.defaultStatus = "("+planeStyle.left+","+planeStyle.top+")"
  if(parseInt(planeStyle.top10) {
   planeStyle.left = 0
   planeStyle.top = 400
  }else{
   planeStyle.left = parseInt(planeStyle.left8
   planeStyle.top = parseInt(planeStyle.top5
  }
 }else if(document.all) {
  var planeStyle=window.document.all.plane.style
  window.defaultStatus = "("+planeStyle.posLeft+","+planeStyle.posTop+")"
  if(planeStyle.posTop < 10) {
   planeStyle.posLeft = 0
   planeStyle.posTop = 400
  }else{
   planeStyle.posLeft += 8
   planeStyle.posTop -= 5
  }
 }
}
</script>
<body bgcolor="blue" onload="setInterval('fly()',100)">
<div name="heading" style="position:absolute;left:100;top:100;z-index:3">
<h1 style="color: rgb(255,255,0);">Welcome to the Aviation Home Page!</h1>
</div>
<div id="plane" style="position:absolute;left:0;top:400;z-index:2">
<img src="http://www.java2s.com/style/logo.png">
</div>
<div id="cloud1" style="position:absolute;left:150;top:300;z-index:3">
<img src="cloud.gif">
</div>
<div id="cloud2" style="position:absolute;left:250;top:200;z-index:3">
<img src="cloud.gif">
</div>
<div id="cloud3" style="position:absolute;left:350;top:150;z-index:1">
<img src="cloud.gif">
</div>
<div id="cloud4" style="position:absolute;left:350;top:250;z-index:1">
<img src="cloud.gif">
</div>
</BODY>
</HTML>
           
       
Related examples in the same category
1.  Circle Animation
2.  Right to left animation
3.  Flash animation in Javascript
4.  Flash animation in JavaScript: Changing style Properties
5.  Animation along Straight Line
6.  Animation along a Circle
7.  Dancing Text (IE)
8.  Type Writer effect (IE)
9.  Type Writer Effect 1.1 (IE)
10.  JavaScript Ticker 1.2 (IE)
11.  Animation: Lottery Number Picker and Statistics
12.  Animation: wriggly
13.  Animation: welcome message
14.  Animation: trio
15.  Auto lotto dip
16.  Animation: snow
17.  Animation: star
18.  Animation: mouse doodle
19.  Animation: fireworks
20.  Animation: pretty
21.  Animation: Random Movement
22.  Lotto number draw
23.  Following eyesHas Download File
24.  Animation: three eyesHas Download File
25.  Animation: eyesHas Download File
26.  Spot lightHas Download File
27.  Big static eyesHas Download File
28.  Animation based on DIV with color flash
29.  Framework for creating CSS-based animations
30.  Animate dynamic element h1 tag
31.  Popup window animation (fly across screen)
32.  Animation on several images
33.  Using the onFilterChange Event Handler
34.  JavaScript Animation
35.  Periodically Updating the Text Displayed by an HTML Element
36.  Link Hint Scroller 2.0 (IE)
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.