Microsoft JScript: Frequently Asked Questions

Microsoft Corporation

Updated: October 1997

What is JScript?

Microsoft® JScript™ is a powerful scripting language targeted specifically at the Internet. It is implemented as a fast, portable, lightweight interpreter for use in World Wide Web browsers and other applications that use ActiveX™ controls, Automation servers, and Java applets.

How do I get JScript?

JScript is currently only available as part of Microsoft Internet Explorer 3.0. You can download Internet Explorer from http://www.microsoft.com/ie/.

Where can I find JScript documentation?

Documentation can be found in the MSDN Library in the Tools and Technologies bin.

What support is there for JScript?

There are a variety of information options available at http://www.microsoft.com/SUPPORT/.

How does JScript compare to VBScript and Java?

When used in Internet Explorer, JScript is directly comparable to Visual Basic® Scripting Edition (VBScript) and not to Java. Like Visual Basic Scripting Edition, JScript is a pure interpreter that processes source code embedded directly in the HTML. JScript code, like Visual Basic Scripting Edition code, does not produce stand-alone applets but is used to add intelligence and interactivity to HTML documents. For developers familiar with C and C++, JScript provides familiar syntax and language features.

What platforms will support JScript?

JScript is available or under development for Windows 95 and Windows NT (including native versions for Alpha, MIPS, and PowerPC architectures), 16-bit Windows, and Macintosh®. Microsoft is working with third parties to provide UNIX versions for Sun Microsystems, Hewlett-Packard, Digital Equipment Corporation, and IBM platforms.

I'm writing an application of my own that needs a scripting language. Can I use JScript as a scripting language for my application?

Yes. If you write it to support ActiveX Scripting, your application can host JScript and users of your application can use JScript. Because ActiveX Scripting is an open standard, your application can host any other language that is written to that standard. You must acknowledge the use of Microsoft technology and include the appropriate trademark and copyright information, but you can use and distribute JScript free of royalties.

What objects, methods, properties, and events can I use?

There are three separate classes of objects available within JScript:

The JScript engine provides the core run-time functionality, including a minimal set of basic objects. The vast majority of objects used in scripting are provided by Internet Explorer. In general, anything that is specific to the Internet is provided by IE, and anything that is generally useful is provided directly in JScript. The Web author can insert additional objects through the <OBJECT> HTML tag.

The most complete documentation of the objects, methods, events, and properties available in Internet Explorer are available in the Platform SDK documentation on the MSDN Library.

How can I write HTML text to the window?

You can use the Document.write method to write any text, HTML or otherwise, to the window. These commands must be executed before the document has finished loading. The best way is to execute JScript commands that are inline, not subroutines or functions that are triggered by events.

How can I change the content of another frame?

Use parent.frames[1].location.href="filename.htm"

Note   Frames start numbering at 0, so if you have 2 frames, they are frames[0] and frames[1].

You can use the name of the frame instead of the index reference, as in:

parent.rightframe.location.href="filename.htm"

How can I get the value of an object property or variable in another frame?

Use top.framename.varname or parent.framename.varname. To get the value of a control property use top.framename.control.property.

How can I access an object in another frame?

Use top.framename.objectID (or parent...). For example:

parent.controls.Axa1.FireImportedEvent 101

What is ECMAScript?

The ECMAScript standard describes a Web scripting language that can enrich and enliven Web pages in a Web browser. ECMAScript is the only standard scripting language on the Web; it is based on the ECMA-262 specification, which outlines an object-oriented programming language for performing computations and manipulating objects within a host environment, such as the browser. The complete ECMA-262 specification can be found at http://www.ecma.ch/stand/ecma-262.htm.

How is Microsoft supporting ECMAScript?

Microsoft Corp. is delivering JScript development software version 3.0, the first scripting language to fully conform to the ECMA-262 specification, in Microsoft® Internet Explorer 4.0, Internet Information Server 4.0, and the Windows Scripting Host. Microsoft is committed to the standards process and to continuing its active involvement in the ECMA process.

How do JScript and ECMAScript compare?

JScript 3.0 fully complies with the ECMAScript standard. In addition to this standard functionality, JScript 3.0 provides features that Microsoft submitted to be considered for the next ECMAScript specification, including the following:

How do JScript and JavaScript compare?

JScript fully complies with ECMAScript. JavaScript is not currently ECMAScript-compliant. While JavaScript 1.1 served as the basis for ECMA standards work, the standards process has resulted in significant language improvements in the areas of Unicode support, IEEE math functions and improved date functions.

Will JavaScript work in Internet Explorer 4.0?

Most functionality in JScript and JavaScript will work across both the Internet Explorer 4.0 and Netscape Navigator 4.0 browsers. The key issue here is that Internet Explorer 4.0 is already fully EMCA-compliant, while Netscape has announced that it intends to support ECMAScript. Internet Explorer 4.0 continues to lead in the standards arena, through its support for key standards such as ECMAScript.

Is Microsoft delivering JScript across platforms?

Yes. Microsoft is delivering JScript 3.0 or ECMAScript support in all versions of Microsoft Internet Explorer 4.0, including for 32-bit Windows® operating systems, 16-bit Windows, Macintosh, and UNIX platforms. The final release of Microsoft Internet Explorer 4.0 for Windows 95 and the Windows NT® operating system, Internet Explorer 4.0 Preview 1 for Macintosh and Internet Explorer 4.0 Preview 1 for Windows 3.1 and Windows NT 3.51 all support JScript 3.0 today.

I'm writing an application that needs a scripting language. Can I use JScript?

Yes. The binary and source code for JScript 3.0 is available today. This means that applications supporting the ActiveX™ scripting interface can host JScript, and that users of these applications can use JScript. In addition, these applications can host any other language that is written to the ActiveX scripting interface. Microsoft's scripting site (http://www.microsoft.com/scripting/) describes in more detail how developers can distribute and use JScript in their applications at no charge.

To make script engine hosting even easier, Microsoft has released a beta of the Microsoft Script Control. This control allows any application that supports COM to host script engines with only two to three lines of code. The control can be used in Microsoft Visual Basic 5.0 and provides documentation on how to use the control within the Visual Basic environment. The Microsoft Script Control is free and can be downloaded from http://www.microsoft.com/scripting/.