★ wanayoo — archive 1999 http://webtools.com/story/dhtml/TLS19980813S0001Nouvelle recherche | Portail wanayoo
CMP's TechWeb Click Here to Vist CMPNET


WebTools

Search WebTools
 

Article Level
  BEGINNER
   INTERMEDIATE
   ADVANCED

Click Here to Vist CMPNET

 
WebTools members,
log in.

  Toolboxes
  Browsers
  HTML, XML, & CSS
  Graphics & Design
  Multimedia
  DHTML & JavaScript
  Java
  Servers & E-Commerce
  Scripting
  Demo

  All Articles
  Tips & Tricks
  About WebTools

TechWeb Sites
 Byte.com
 CMPmetrics
 Data Communications
 File Mine
 InformationWeek
 InternetWeek
 Network Computing
 Planet IT
 TechShopper
 TechWeb News
 Tele.com
 WebTools
 Winmag.com

  Free E-mail
 Login - Sign Up Now

Click here to visit Alta Vista Get Pointcast free

  Privacy Statement

WebTools: DHTML & JavaScript
 Article Level   INTERMEDIATE  
Auto Rotate Content With JavaScript
Automate daily changes to your Web pages with some JavaScript sleight of hand.
By David W. Methvin, Windows Magazine (06/01/98)

As a Web surfer, I know it's not very compelling to visit a page that doesn't change for months at a time. On the flip side, as a Web-page builder, I dread the work involved in editing and reposting pages. So I decided to build a simple tool anyone can use to change the content of a Web page based on the time or date. For example, you might build a page once every week but incorporate changes that would automatically take effect every day -- and you wouldn't have to re-edit the page on a daily basis.

Products such as Microsoft's FrontPage have features to make timed content rotation easier, but not everyone has access to those tools. If you're using an ISP or Web farm to host your site, it might not even allow you to run any kind of server-side code such as active server pages. So that leaves browser-side scripting -- JavaScript in this case -- as the only choice. Even if you can use FrontPage or some other server-side solution, you might prefer a browser-side script for its simplicity.

There is one important downside to this approach, though. Since the script is run on the browser, anyone who views your Web page's HTML source will be able to see the entire schedule of events you have planned. Most people won't look at the source, but don't be surprised if someone does grab a sneak peek. If it's just a list of holidays or a message of the day, there's no problem. But don't use this script to schedule anything in advance that would get you in trouble if it were disclosed early.

Two less common problems are users with browsers that don't support JavaScript and users who have disabled JavaScript support in their browser's security settings. That is, they're either three years behind the browser adoption curve, or they're extremely paranoid about security. I can't do much to help either group live a richer browsing life, but I do try to make their visit comfortable by degrading the page design gracefully with a <SCRIPT LANGUAGE=NONE> tag and some alternate text.

In This Article:
Auto Rotate Content With JavaScript
Rotation Automation
Events In Action
print
Print this story
email
Send as
e-mail


BYTE's Martin Heller attended the June 1999 JavaOne conference and bagged several interesting audio interviews with important Java players.


Keep track of Java news with Planet IT's Java Tools Index.

Related Stories

WebTools Home | Browsers | HTML, XML, & CSS | Graphics & Design | Multimedia | DHTML & JavaScript | Java | Servers & E-Commerce | Scripting | Demo | All Articles | Threads | WebTools News | Tips and Tricks


C M P n e t   S H O P P I N G
MacTuner V2.1 for Mac
$22.95
Tune in to over 1800 live TV and radio broadcasts and get the most out of your RealAudio and RealVideo players.
Divider
BBEdit V5.1 for Mac
$98.99 !! save 17% !!
A fast, easy, Mac-based HTML authoring tool used by most professional Web Designers.
McAfee VirusScan V4.0 for Win95
$7.99 !! after rebate !!
Protect your PC from all virus types, and receive updates directly on your desktop the moment they're released.

CMPnet Click Here to Vist CMPNET