spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column60


Persistent Random Banners

Developer News
Sir Tim Talks Up Linked Open Data Movement
From L.A. to Vegas With 100GbE
Salesforce Rolls Out Big Summer '08 Update

Building the Message Feed

The message feed is an array of messages, tips, stored in an external file, feed.js. Each member of the array is a message written in an HTML format. You can include any HTML construct like links (<A>...</A>), images (<IMG ...>), and new lines (<BR>). In this column, the feed includes promotions for past tips. Here is one of them:


tips[34] = 'Are you familiar with the DOM\'s Cloning Depth?
          <A HREF="/js/tips/000324.html">
          Learn how to manipulate the whole tree or just
            its root</A>.';

Notice that you have to escape the quote characters with backslashes as we did above in DOM\'s. Here are ten more example tips:


tips[0] = '<A HREF="/js/tips/990923.html">Learn how</A> to load
           a new page while disabling the browser\'s \"Back\"
           function, so the user has no way back.';
tips[1] = 'Do you want to display an eye-catching true color image?
           <A HREF="/js/tips/990924.html">Find out how</A> to select
           an optimized image for your user.';
tips[2] = '<A HREF="/js/tips/990925.html">Find out how</A> to
           generate a random number, so you can load a random Web
           page or display a random message.';
tips[3] = 'Do you want to access various properties and methods of
           the same object? <A HREF="/js/tips/990926.html">You
           don\'t need to repeat the object reference</A>.';
tips[4] = 'How about speeding up your Web site?
           <A HREF="/js/tips/990927.html">Find out how</A> to
           preload your images with JavaScript.';
tips[5] = 'Be sure you are getting real email addresses, not useless
           garbage. <A HREF="/js/tips/990928.html">Check out</A>
           an advanced cross-browser solution.';
tips[6] = 'Is your script ready for the next millennium?
           <A HREF="/js/tips/990929.html">Be sure</A> you\'ve
           nailed down the Y2K issues.';
tips[7] = 'Do you want to share libraries between HTML pages?
           <A HREF="/js/tips/990930.html">Learn how to</A> do it
           with external script.';
tips[8] = 'Do you want old browsers be able to load your page?
           <A HREF="/js/tips/991001.html">Learn how</A> to hide
           the script from them.';
tips[9] = 'Do you know how to use the null value?
           <A HREF="/js/tips/991002.html">Learn how</A> to take
           advantage of it.';

The message feed, feed.js, includes 35 messages, starting with tips[0] and ending with tips[34]. The number of messages that will be actually displayed depends on the parameter value with which you call refreshDocJSTOD(). Calling it with "now" will ensure that, although the order will be random, every message will be actually displayed eventually. For other values of frequency the number of messages pulled out of the total available pool in feed.js is as follows:

  • "month": 12
  • "dayOfTheMonth": 31
  • "dayOfTheWeek": 7
  • "hour": 24
  • "now": all

Next: The Code

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Book Review: Head First JavaScript · Web Hosting Control Panels · Use Your Blog for Fast Search Engine Rankings
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
NetApp's Virtual Storage Strategy Crystallizes · F/MC Watch: A Cisco-Centric Approach · Olympic Time Trials Use Wi-Fi Mesh


Created: March 27, 2000
Revised: April 26, 2000

URL: http://www.webreference.com/js/column60/4.html