FP98: VBScript in Head Tag Breaks Navigation Bar Hover Buttons

Last reviewed: March 18, 1998
Article ID: Q178449
The information in this article applies to:
  • Microsoft FrontPage 98 for Windows

SYMPTOMS

When browsing a page, you receive an error message similar to one of the following.

Internet Explorer 4.0

   An error has occurred in the script on this page.

      Line:  27
      Char:  15
      Error: Expected 'Then'
      Code:  0

   Do you want to continue running scripts on this page?

You will have the option to click Yes or No.

Internet Explorer 3.02

   Microsoft VBScript compilation error

      [Line: 27] 'Then'

   if(MSFPhover) document['MSFPnav1'].src=MSFPnav1h.src

These error messages may vary, depending on the type and version of your browser.

CAUSE

This behavior occurs because you have added Microsoft Visual Basic Scripting Edition (VBScript) code in the <HEAD> tag of a page containing a navigation bar. When you browse the page, the browser generates an error. Hover buttons use JavaScript code in the event handlers. By placing VBScript code in the <HEAD> tag, you are setting the Internet Explorer default script environment to VBScript. This being the case, Internet Explorer will interpret your IF statement in the ONMOUSEOVER event as if it were VBScript, rather than JavaScript. When VBScript does not see a THEN to complete the IF ... THEN statement, the browser generates the error message.

RESOLUTION

To resolve this issue, use any of the three methods.

Method 1

Ensure that the first script encountered on a page is JavaScript instead of VBScript.

Method 2

Add a JavaScript protocol indicator to each event handler, as in the following example:

   <a href="./" onmouseover="JAVASCRIPT:if(MSFPhover)
   document['MSFPnav1'].src=MSFPnav1h.src"
   onmouseout="JAVASCRIPT:if(MSFPhover)
   document['MSFPnav1'].src=MSFPnav1n.src">

NOTE: Enter this text as a single line of HTML code.

Method 3

Add a LANGUAGE="JAVASCRIPT" attribute to the <A HREF> tag, as in the following example:

   <a href="./" LANGUAGE="JAVASCRIPT" onmouseover="if(MSFPhover)
   document['MSFPnav1'].src=MSFPnav1h.src" onmouseout="if(MSFPhover)
   document['MSFPnav1'].src=MSFPnav1n.src">

NOTE: Enter this text as a single line of HTML code.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


Additional query words: front page
Keywords : fpedit fphtml fpscript kbdta kbfixlist
Version : WINDOWS:98
Platform : WINDOWS
Hardware : x86
Issue type : kbbug
Solution Type : kbpending


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.