Other Sections
Bookmark to


Flying Message script II

Author: Dynamic Drive

Description: Embed any external HTML document onto the page and fly it across the screen, with this cool DHTML script! Since the content to animate is a separate document, the job of updating and modifying it becomes a breeze. Use this script to display site announcements, news, featured content etc. The possibilities are endless...

This script differs from the original Flying Message script in that it is considerably more robust, accepting almost any external HTML document to display without a problem. Version 1 (which only works in NS 4+), is not that forgiving.

Demo: Watch for the flying message IE 5 users!
Note: Here's the external document used.

Directions Developer's View

Step 1: Simply copy the below into the <HEAD> section of your page:

Select All

Step 2: Lastly, add the following to the <BODY> tag itself, like below:

<body onLoad="if (document.all&&window.print) readymessage()">

Fly away Peter Pan!

Configuring the script

As always, we tried to make this script as easy to configure as possible. There are four variables in the code above you'll need to modify, all which are explained below:

messageurl The name (path) of the external document to download and display (ie: "message.htm")
offset_top The amount (in pixels) the flying message should be offset from the top of the browser (ie: 100)
offset_left he amount (in pixels) the flying message should be offset from the left of the browser before the animation begins (should be negative, and greater than width of external document, ie: -300)
speed The speed of the flying message, where a larger number equals faster (ie: 4).
onoff This variable allows you to conveniently turn off the flying message (so it doesn't animate across the screen). Valid values are "on' and "off'.