ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
JScript - Wikipedia, the free encyclopedia

JScript

From Wikipedia, the free encyclopedia

JScript
Appeared in 1996
Developer Microsoft
Latest release 5.7/ November 2006
Typing discipline dynamic, weak, duck
Major implementations Windows Script, JScript .NET
Influenced by Javascript, ECMAScript
OS Microsoft Windows
Website JScript

JScript is the Microsoft dialect of the ECMAScript scripting programming language specification.

JavaScript (the Netscape/Mozilla implementation of the ECMA specification), JScript, and ECMAScript are very similar languages. In fact the name "JavaScript" is often used to refer to ECMAScript or JScript.

JavaScript is used on web pages for scripting, although it can be and is also used in other embedding scenarios.

For general information about the language, its history, and uses see the JavaScript article. The article on ECMAScript has information on various dialects and implementations of ECMAScript and the history of the specification. JavaScript syntax is described in its own article. The rest of this article focuses on Microsoft implementation.

JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages, and Windows Script Host. It also means that any application supporting Windows Script can use multiple languages — JScript, VBScript, Perl, and others. JScript was first supported in Internet Explorer 3.0 browser released in August 1996. As with any other Active Scripting engine, it is available through Internet Explorer, Windows Script Host, and Active Server Pages. The typical file extension of JScript source code files is .js.

The most recent version of JScript is JScript .NET, which is based on the yet-unfinished edition 4 of the ECMAScript standard, and can be compiled for the Microsoft .NET platform. JScript.NET adds several new features to ECMAScript ed. 3, such as optional static type annotations.

Contents

[edit] Versions

[edit] JScript

The original JScript is an Active Scripting engine. Like other Active Scripting languages, it is built on the COM/OLE Automation platform and provides scripting capabilities to host applications. This is the version used when hosting JScript inside a Web page displayed by Internet Explorer, in an HTML application, in classic ASP, in Windows Script Host scripts and several other Automation environments. JScript is sometimes referred to as "classic JScript" or "Active Scripting JScript" to differentiate it from newer .NET-based versions.

Version Date Introduced with[1] Based on1 Approx. JavaScript
1.0 Aug 1996 Internet Explorer 3.0 Netscape JavaScript 1.0
2.0 Jan 1997 Windows IIS 3.0 Netscape JavaScript 1.1
3.0 Oct 1997 Internet Explorer 4.0 ECMA-262 1st edition2 1.3
4.0 Visual Studio 6.0 (as part of Visual InterDev) ECMA-262 1st edition 1.3
5.0 Mar 1999 Internet Explorer 5.0 ECMA-262 2nd edition 1.4
5.1 Internet Explorer 5.01 ECMA-262 2nd edition 1.4
5.5 Jul 2000 Internet Explorer 5.5 & Windows CE 4.2 ECMA-262 3rd edition 1.5
5.6 Oct 2001 Internet Explorer 6.0 & Windows CE 5.0 ECMA-262 3rd edition 1.5
5.7 Nov 2006 Internet Explorer 7.0 ECMA-262 3rd edition + ECMA-327 (ES-CP)3 1.5

Note (1): JScript supports various features not specified in the ECMA standard[2], as does JavaScript.

Note (2): JScript 3.0 is "the first scripting language to fully conform to the ECMA-262 standard" (Source: Microsoft PressPass)

Note (3): JScript 5.7 includes an implementation of the ECMAScript Compact Profile (ECMA-327) which turns off features not required by the ES-CP when using the "JScript.Compact" ProgID.

JScript is also available on Windows CE (included in Windows Mobile, optional in Windows Embedded CE). The Windows CE version lacks Active Debugging.

(Source: MSDN, WebmasterWorld Forum)

[edit] Managed JScript

Managed JScript is an implementation of JScript for the Dynamic Language Runtime, it is part of Microsoft's dynamic languages for .NET along with IronRuby, IronPython, and Dynamic Visual Basic. Unlike JScript .NET which is less dynamic than the original JScript but provides CLS compatibility, Managed JScript is designed on top of the DLR and provides the features needed for scripting scenarios.

While it is primarily designed to be used within Silverlight and ASP.NET at this time, it can also easily be embedded within any .NET application.

(Source: JScript Blog, Jim Hugunin's Thinking Dynamic blog, Source: Blog of Jitu)

Two builds of Managed JScript exists, one for the Desktop CLR and one for the CoreCLR (Microsoft Silverlight)

Version Platform Date Introduced with Based on
1.0.0.0 Desktop CLR 2.0 2007 ASP.NET Futures (July 2007 preview) ECMA-262 3rd edition
1.1.20625.0 CoreCLR 1.1 2007 Microsoft Silverlight 1.1 Alpha (Sep 2007 refresh) ECMA-262 3rd edition

Managed JScript is not supported in the .NET Compact Framework.

(Source: files versions of Microsoft.JScript.Runtime.dll in ASP.NET Futures and Silverlight 1.1 folders)

[edit] JScript .NET

Main article: JScript .NET

JScript .NET is a Microsoft .NET implementation of JScript, it is a CLS language and thus inherit very powerful features, but lacks many features of the original JScript language, making it inappropriate for many scripting scenarios. JScript .NET can be used for ASP.NET pages and for complete .NET applications, but the lack of support for this language in Microsoft Visual Studio place it more as an upgrade path for classic ASP using classic JScript than as a new first-class language.

Version Platform Date Introduced with Based on
7.0 Desktop CLR 1.0 2002-01-05 Microsoft .NET Framework 1.0 ECMA-262 3rd edition4
7.1 Desktop CLR 1.1 2003-04-01 Microsoft .NET Framework 1.1 ECMA-262 3rd edition4
8.0 Desktop CLR 2.0 2005-11-07 Microsoft .NET Framework 2.0 ECMA-262 3rd edition4

Note (4): JScript .NET is "being developed in conjunction with ECMAScript Edition 4" (Source: MSDN)

JScript .NET is not supported in the .NET Compact Framework.

Note JScript .NET versions are not related to classic JScript versions. JScript .NET is a separate product. Even though JScript .NET is not supported within the Visual Studio IDE, its versions are in sync with other .NET languages versions (C#, VB.NET, VC++) that follows their corresponding Visual Studio versions.

.NET Framework 3.0 and 3.5 are built on top of 2.0 and do not include newer releases of JScript .NET.

(Source: file version of Microsoft.JScript.dll in each framework install)

[edit] Samples

Classic JScript can be used in many applications. Most common uses are client-side script in Internet Explorer and administrative scripts using the Windows Script Host (WSH, aka WScript). Because the application hosting JScript adds its own objects, functions and properties, the language has a limited set of built-in features and any real use depends on the hosting application. Managed JScript follows the same idea, and the hosting application adds objects to the engine.

[edit] JScript in Windows Script Host

This sample shows how JScript uses COM/OLE Automation objects and enumerations, and how the WScript object, which is part of the Windows Script Host, is made available to JScript. It can be simply saved as a .js script file and executed as it (it is associated with WScript.exe for GUI mode, or CScript.exe for CLI mode).

var fso = new ActiveXObject("Scripting.FileSystemObject");
var fldr = fso.getFolder("C:\\Windows");
 
var msg = new Array();
msg.push("Files in \""+ fldr.path +"\" :\r\n\r\n")
 
var ef = new Enumerator(fldr.files);
for( ef.moveFirst(); !ef.atEnd(); ef.moveNext() )
        msg.push(ef.item().name +"\r\n");
 
WScript.echo(msg.join(""));

[edit] JScript in Internet Explorer

This client-side sample shows how classic JScript works within Internet Explorer to execute script embedded in or linked from Web pages. Just like WSH makes the WScript object available to JScript, Internet Explorer makes the window object available to JScript, and makes all window members global members (document object, alert function, …).

<html>
<head>
        <script language="JScript">
        function init()
        {
                var el = document.getElementById("dhtmlspan");
                el.innerHTML = "Executed when done loading page.";
        }
        </script>
</head>
<body onload="init()">
 
        <p>
                <script language="JScript">
                document.write("Executed during load.");
                </script>
        </p>
 
        <p>
                <span id="dhtmlspan">Please wait…</span>
        </p>
 
</body>
</html>

[edit] JScript in Active Server Pages

ASP is an extension to IIS to run server-side Active Scripting code. Blocks between <% and %> are parsed and executed on the server, as well as standard script blocks with the runat argument set to "server". The ASP framework provides Request, Response and Server objects to the script engine to allow code to inject data in the response sent to the client and to retrieve data from the request (form, querystring, posted data).

<%@ language="JScript"%>
<html>
<body>
    <%
        Response.write("Executed server-side when generating the response.<br/>");
    %>
 
    <script language="JScript" runat="server">
    Response.write("Executed last<br/>");
    </script>
 
    <%= "The = prefix is identical to Response.write.<br/>" %>
 
</body>
</html>

[edit] JScript .NET

JScript .NET is a compiled language. It generates CIL binaries for stand-alone console and windows applications, libraries, or ASP.NET programs. The command-line compiler is included in the .NET Framework.

import System;
 
var _name;
 
Console.WriteLine("Hello, what's your name?");
Console.WriteLine("Type your name: ");
 
var _name = Console.ReadLine();
//provide a number and it will output it below, without error
 
Console.WriteLine("Hello, " + _name);

You can compile this file using JSC to generate a .exe file: jsc sample.js.

JScript .NET can be used server-side for Web applications with the ASP.NET framework. Visual Studio usually generate code-behind, but inline code, similar to classic ASP, will get compiled to CIL and then executed on the fly.

<%@ Page Language="JScript"%>
<html>
<body>
    <%
        Response.Write("Compiled on the fly and executed server-side.<br/>");
    %>
</body>
</html>

While the @ directive seems to imply classic JScript, ASP.NET pages (.aspx) never uses Active Scripting engines. It will try to load a .NET CLR language and this page will be processed by the JScript .NET compiler.

[edit] Managed JScript in ASP.NET

Managed JScript can be used server-side with ASP.NET with the DLR extensions. This is currently only available with the ASP.NET Futures preview.

<%@ Page Language="ManagedJScript"%>
<html>
<body>
    <%
        Response.Write("Executed on the fly server-side.<br/>");
    %>
</body>
</html>

To be able to execute this on .NET 2.0, the DLR framework and Managed JScript references must be included in the Web.config assemblies references.

[edit] Differences from JavaScript

JScript supports Conditional comment, but JavaScript does not.
In addition to other internal implementation differences, JScript uses non-generational mark-and-sweep garbage collection[3] whereas JavaScript (the original implementation of which is the SpiderMonkey engine) uses a generational mark-and-sweep system.

[edit] See also

[edit] References

  1. ^ Microsoft Developer Network. Version Information (JScript 5.6). Retrieved on 2007-08-12.
  2. ^ Microsoft Developer Network. Microsoft JScript Features - Non-ECMA (JScript 5.6). Retrieved on 2007-08-12.
  3. ^ Eric Lippert. How Do The Script Garbage Collectors Work?. Retrieved on 2007-08-12.

[edit] External links

[edit] JScript downloads

The latest versions of classic JScript (5.6 and 5.7) are bundled with Internet Explorer, so it is already installed and up to date on many Windows computers. For people using another browser and not installing Internet Explorer updates the JScript engine is also available as part of the Windows Script package, which is the set of scripting components of Windows (containing VBScript, JScript, Windows Script Host, Windows Script Component and Windows Script Runtime).

The latest version for Windows 98, Me and NT4 is Windows Script 5.6, which used to be available on Microsoft Download Center but seems to have been removed when 5.7 went online. Windows Vista already contains Windows Script 5.7.

[edit] JScript .NET downloads

The latest version of JScript .NET is bundled with the .NET Framework 2.0.

[edit] Managed JScript downloads

Managed JScript isn't final yet, but preview versions are bundled with Silverlight 1.1 preview and ASP.NET Futures preview.


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -