Ask Mr. D - JavaScript

Written by Bill Daugherty


Dear Mr. D,

I have noticed several websites that have a sale's message that scrolls across their title bar. Another site I visited had a sale's message scrolling acrossrepparttar status bar.

These messages really caught my eye. I figure if they are eye catching then they must be great sales tools.

I want to install something like that on my site, but I can't find out how to do it. I have several books on HTML, but none of them cover anything that that.

Do you know how it's done. Please keep it simple. I don't have much experience in web design.

Thanks in advance for your help.

Signed,

Sandra

____________________

Dear Sandra,

The scrolling marquee type messages are are produced by JavaScript codes. That's why you couldn't find them in any of your HTML books.

Javascript; Browser Detection and Page Redirection

Written by William J. Tolson


A recent project was developed using Internet Explorer 5.5 asrepparttar browser of choice. Aware of browser incompatibilities, viewingrepparttar 105598 web page using three other commonly used browsers, Internet Explorer 4.0, Netscape Navigator 6.1, and Netscape Navigator 4.7 revealed some 'distortions'. This was mainly due to whether or not a particular browser could interpret style sheets, and if so howrepparttar 105599 style sheets were interpreted.

It was apparent thatrepparttar 105600 page code either needed to be downgraded torepparttar 105601 'lowest common denominator' or alternative versions ofrepparttar 105602 web page were needed for Netscape 6.1, Netscape 4.7, and Internet Explorer 4.0. Therefore, a version optimized for Netscape 6.1 was created, as well as another version compatible for both Netscape 4.7 and Internet Explorer 4.0. (This was before Internet Explorer 6.0 and Netscape 6.2 were available.)

Review of several current web sites and textbooks on Javascript presented different approaches to writing script to first detect a user's browser, and then depending onrepparttar 105603 browser and version, to redirectrepparttar 105604 user to a specific page. In this particular case, none ofrepparttar 105605 recommendations or solutions were what was needed. After a good deal of testing and re-testing,repparttar 105606 following script examples were assembled.

Below are five different examples / variations of some Javascript that is to be placed on a page that is optimized for Internet Explorer 5.5. These scripts will then automatically detectrepparttar 105607 visitor's browser and version, and then automatically directrepparttar 105608 particular browser in one of three directions. They are;

If a visitor is using Internet Explorer 5.5, to remain onrepparttar 105609 current page.

If a visitor is using Netscape 6.1, to be redirected to a page that has been optimized for Netscape 6.1.

If a visitor is using Internet Explorer 4.0 or Netscape 4.7, to be redirected to a third page that has been written specifically for either of these browser versions.

Explanatory discussion followsrepparttar 105610 script examples.

#1 ---------------------------------------------------------------- #2 --------------------------------------------------------------- #3 --------------------------------------------------------------- #4 --------------------------------------------------------------- #5 ---------------------------------------------------------------

Any of these five different scripts can be utilized. These have been compiled after many attempts at using other suggested scripts that either were too limited, were not applicable to identifying version 5 and higher browsers, or just did not seem to work as anticipated.

All these scripts are a series of conditional statements, which are read byrepparttar 105611 visitor's browser whenrepparttar 105612 web page 'ie55.htm' is loaded.

1. The browser readsrepparttar 105613 first statement and if it is Netscape 6.1, it is redirected torepparttar 105614 page written specifically for Netscape 6.1. If not,

2. The browser readsrepparttar 105615 next statement and if it is Netscape 4.7, it is redirected torepparttar 105616 page written forrepparttar 105617 'number 4’ version of either Internet Explorer or Netscape Navigator. If not,

Cont'd on page 2 ==>
 
ImproveHomeLife.com © 2005
Terms of Use