<p align="center"> <font color="red"> Warning: WebTV JavaScript Bug – Please Reload (Cmd-R)! Attn: PC Users Must Have Frames Enabled To View This Webpage! </font> </p>

PageBuilder Blinking Status Bars

Example of a Blinking Status Bar Message

     The following is an example of a single line blinking status bar message. For WebTV, the message must not be longer than 35-characters to fit in the status bar space at the bottom of the screen. If you want to center shorter messages in the status bar, use "Alt-Space" in the message variable as I did here.

Note: I used the "javascript:void()" operator as the "href" attribute value in the links below to keep the <a> tag link from trying to "go somewhere" while invoking the "onClick" event handler, and I also used the "javascript: " protocol in some of the links. So take note: sometimes the old familiar WebTV javascript "bug" will occur when this webpage is opened which causes these links containing these operators to appear in a "red highlight box" that will cause an "Alert" saying: "Addresses must begin with "http://," when you click the links. If you see "red" highlight boxes around the following links, just reload (Cmd-R) until the links show the "yellow" highlight box.

     To see a blinking status bar message, click here. To stop the blinking status bar, click here.

The script I used is:

<script type="text/javascript" language="javascript"> function blnkStat() {window.status="                       Blinking Status Bars"; {timer=setTimeout("window.status=''",300); {timer0=setTimeout("blnkStat()",600);}}};</script>

     To see a blinking status bar message, click <a href="javascript:void()" onMouseover="clearAll()" onClick="blnkStat()">here. </a> To stop the blinking status bar, click <a href="javascript:void()" onClick="clearTimeout(timer),clearTimeout(timer0),window.status='PageBuilder Blinking Status Bars';return true;">here.</a>


Note: In the above script, I put the "Stop" link "clearTimeout" in the "onClick" event handler. In subsequent scripts you will see that also I wrote the "Stop" link "clearTimeout" as a "function" within the script for each example. You can do it either way; but, you should try to be consistent which ever way you choose to write your scripts. I suggest that you should always include a "clearTimeout" function in all your "timer" scripts.

     Here is another blinking status bar message that uses the "setTimeout" method to switch between two (2) functions that alternately write and clear a status bar message. To see this flashing status bar message script, click here. To stop this flashing message, click here.

The script I used for this message is:

<script> var msg="                   A Flashing Status Bar"; var nomsg=""; function flashMsg() {window.status=msg; timer7=setTimeout("clearStat()", 200);} function clearStat() {window.status=nomsg; timer8=setTimeout("flashMsg()", 200);} function stopTimers() {clearTimeout(timer7); clearTimeout(timer8); window.status="PageBuilder Blinking Status Bars";};</script>

To see this flashing status bar message script, click <a href="javascript:flashMsg()" onMouseover="clearAll()">here.</a> To stop this flashing message, click <a href="javascript:stopTimers()">here.</a>


     Here is script with an "if-else" conditional construct with setTimeout that creates a loop that may be easier for you to write, due to its simplicity. I used a variable named "contrlogic" for the "true-false" loop control logic, set to "true" in the loop "if" expression to execute the status bar message write statement, then changed the "contrlogic" variable to "false" so the loop "else" statement would execute the status bar "blanking" interval, which then set the "contrlogc" variable back to "true" to continue the loop.

     To see this status bar blinker loop script, click here. To stop the status bar blinker, click here.

The code I used is:

<script> var mymsg="                    Status Bar Blinker"; var statblnk=""; var pgetitle="PageBuilder Blinking Status Bars"; var rate=200; var contrlogic=true; function statBlinker() {if (contrlogic==true) {window.status=mymsg; contrlogic=false;} else {window.status=statblnk; contrlogc=true;} timer9=setTimeout("statBlinker()", rate); function stopBlinker() {clearTimeout(timer9); window.status=pgetitle;}};<:/script>

     To see this fast status bar blinker loop script, click <a href="javascript:statBlinker()" onMouseover="clearAll()">here.</a> To stop the status bar blinker, click <a href="javascript:stopBlinker()">here.</a>



Multiple Blinking Status Bar Messages

The "nested setTimeout" script can be used to blink multiple messages in the status bar by cascading the nested message scripts; ie, looping thru two or more successive blinking messages, with the ending message setTimeout method looping back to the beginning message.

     To see an example of three blinking messages, click here. To stop the blinking messages, click here.

Here's the script I used for the three blinking messages:

<script> function threeMsgs() {window.status="                    First Blinking Message"; {timer1=setTimeout("window.status=''",600); {timer2=setTimeout("window.status='                   Second Blinking Message'",1200); {timer3=setTimeout("window.status=''",1800); {timer4=setTimeout("window.status='                    Third Blinking message'",2400); {timer5=setTimeout("window.status=''",3000); {timer6=setTimeout("threeMsgs()",3600); function clearTimers() {clearTimeout(timer1);clearTimeout(timer2);clearTimeout(timer3);clearTimeout(timer4);clearTimeout(timer5);clearTimeout(timer6);window.status="PageBuilder Blinking Status Bars";}}}}}}}};</script>

     To see an example of three blinking status bar messages, click <a href="javascript:threeMsgs()" onMouseover="clearAll()">here</a>. To stop the blinking messages, click <a href="javascript:clearTimers()">here</a>.


     In the script above, see how the nested setTimeout(s) cause the cascading loop thru the messages and back to the beginning function statement? Note how the setTimeouts are properly "nested" by the statement(s) "curley brackets" ({}) – ie; the "nesting" is done with the successive setTimeout statements which are defined by successive "starting" curley brackets only to separate the statements, with all "ending" curley brackets at the end of the script. Also, note how I had to clear all six (6) timers with the "clearTimers()" function so all looping would immediately stop when I clicked the stop button. I restored the webpage title to the status bar with the "clearTimers()" function.

     The "Start" and "Stop" links I used in this script illustrate the use of the "javascript:" protocol in the <a> link tag to "call" the functions. It's simplier than using the "javascript:void()" operator which requires an event handler that, I used in the first script as an example. Which to use? It's just a matter of personal preference among scripters. But, most scripters are consistent with their preferred methods – they use each method for specific purposes.

     As noted on Page 1, all of these messages can flash concurrently in the status bar if I did not stop each script before starting the next script. To prevent multiple scripts running together in the status bar, I wrote a function to clear all timers. You can see in the "Start" links above how I "call" the "clearAll()" function with an "onMouseover" event handler in each link.

Here's the script I used for the "clearAll()" function:

<script> function clearAll() {clearTimeout(timer); clearTimeout(timer0); clearTimeout(timer1); clearTimeout(timer2); clearTimeout(timer3); clearTimeout(timer4); clearTimeout(timer5); clearTimeout(timer6); clearTimeout(timer7); clearTimeout(timer8); clearTimeout(timer9); window.status="PageBuilder Blinking Status Bars";};</script>

    Multiple blinking status bar message scripts continued on next page. Use the source code viewer below to see the code for this page.


View the of this webpage with the Thunderstone Source Code Viewer


previous page
Powered by MSN TV
next page