The information in this article applies to:
SYMPTOMSMicrosoft Internet Explorer supports both JavaScript and VBScript functionality. For compatibility reasons, the default is JavaScript. If a block of <Form> code is placed ahead of a block of <script> code, errors may result. RESOLUTIONTo prevent these errors, always place <script> tags ahead of any objects that call into functions defined with the tags. By moving the <script> tag and associated code ahead of the form definition, the VBScript compiler is invoked and the Button element correctly references the function it calls in the onClick event. STATUSThis behavior is by design. Internet Explorer 3.0 defaults to JavaScript compilation. MORE INFORMATIONAs an HTML page containing VBScript or JavaScript, code is loaded by IE 3.0, it is parsed and compiled. If a form element makes a call to some function that is later defined within a <script> tag, errors can result if the form element does not use the proper calling conventions. IE 3.0 defaults to using the JavaScript compiler. When the compiler sees the form element, it generates JavaScript code to make the function call associated to the form element. If the <script> tag is defined after the form element and specifies Language="VBScript," this function call is syntactically incorrect and an error results. To avoid this error, all <script> tags should be defined before any form or other objects that make functions calls. The preferred placement of the <script> tag is within the <Head></Head> tags. By using this placement, any function that may be called by a forms element has already been loaded and compiled. Steps to Reproduce Behavior --------------------------- The HTML code below demonstrates the problem:
Because the compiler reads the form definition first, it compiles the
onClick event into a JavaScript reference. When the button is clicked, the
interpreter tries to find the appropriate JavaScript function to execute.
However, the function is in a block of VBScript code and is not seen by the
interpreter as executable JavaScript code. Therefore, an "object doesn't
support the property or method" error results.
Additional query words: kbdse kndsi vbscript vbs
Keywords : kbScript kbIE500 vbObjMdlIE vbsEnvtIE kbIEFAQ |
Last Reviewed: January 27, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |