FP: How to Create a Scrolling Message in Browser's Status Bar

Last reviewed: March 18, 1998
Article ID: Q167596
The information in this article applies to:
  • Microsoft FrontPage 98 for Windows
  • Microsoft FrontPage 97 for Windows with Bonus Pack

SUMMARY

This articles provides two sample FrontPage Java scripts that display a custom, scrolling message in the Internet Explorer status bar.

MORE INFORMATION

WARNING: ANY USE BY YOU OF THE JAVA SCRIPT PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this script "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This script is provided 'as is' and Microsoft does not guarantee that the following script can be used in all situations. Microsoft does not support modifications of the script to suit customer requirements for a particular purpose.

Example 1

NOTE: Before you insert this code using the FrontPage 97 Editor, remove the following items:

   <SCRIPT>
   <!--
   </SCRIPT>
   //-->

Insert the following script into your normal HTML Web page:

   <SCRIPT LANGUAGE="JavaScript">
   <!--
   // Scrolling text string.
   var scrollString = "Replace this string with your text."

   // Width of the scrolling area.
   var width = 120;

   var stringLength = scrollString.length;
   var pos = 1 - width;
   // Start far enough to the left so that only one letter shows.

   function ScrollMessage(){
      var ScrollMessage = "";
   // Initialize the string to be printed.

       pos++;
   // Move to the right in the string.

       if (pos == stringLength)
   // Start over if the string is done.

       pos = 1 - width;
   // Scrolling

       if (pos<0) {
   // Add spaces to beginning if necessary.

           for (var i=1; i<=Math.abs(pos); i++)
               ScrollMessage = ScrollMessage + " ";
   ScrollMessage = ScrollMessage;
      + scrollString.substring(0, width;
      - i + 1);
    }
   else
   ScrollMessage = ScrollMessage;
      + scrollString.substring(pos, pos +;
   width);
   window.status = ScrollMessage;
   // Print the string.

       setTimeout("ScrollMessage()",100);
   // Repeat after 1/10 second.
   }

   //-->
   </SCRIPT>

In order for the message to function, modify the <BODY> tag so that it looks like this:

   <BODY OnLoad="ScrollMessage()">

Example 2

To add a Java Script to a FrontPage Web page, use these steps:

  1. Start FrontPage Editor.

  2. On the Insert menu, point to Advanced, and then click Script. (In FrontPage 97, click Script on the Insert menu.)

  3. Under Language, click JavaScript.

  4. In the Script box, type the following code.

        NOTE: You can modify the values for strText and intSpeed to
        specify your own message and scrolling preferences.
    

          var strText="This is a scrolling message!";
          var intText=strText.length;
          var intSpeed=25;
          var intWidth=100;
          var intPos=1-intWidth;
    

          function scroll()
          {
    
            intPos++;
            var strScroll="";
            if (intPos==intText)
            {
              intPos=1-intWidth;
            }
            if (intPos<0)
            {
              for (var i=1; i<=Math.abs(intPos); i++)
              {
                strScroll=strScroll+" ";
              }
              strScroll=strScroll+strText.substring(0, intWidth-i+1);
            }
            else
            {
            strScroll=strScroll+strText.substring(intPos,intWidth+intPos);
            }
            window.status = strScroll;
            setTimeout("scroll()", intSpeed);
          }
    
    

  5. Click OK.

  6. On the Insert menu, point to Advanced, and then click Script. (In FrontPage 97, click Script on the Insert menu.)

  7. Click Script Wizard.

  8. Click List View.

  9. In the Event pane, expand the Window event, and then click the onLoad event.

  10. In the Action pane, expand Procedures, and then click Scroll.

  11. Click Insert Action.

  12. Click OK.

  13. On the File menu, click Save.


Additional query words: 97
Keywords : fpedit fpscript kbcode kbdta
Version : windows:97,98
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 18, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.