|
很多人都誤以為JScript就是JavaScript的縮寫,這一點是需要澄清的,讓筆者先講一段故事。
在Web Scripting language世界中第一個誕生的是,由網景公司(NetScape)所催生的JavaScript。到了1996年11月,ECMA開始根據JavaScript 1.1的規格,著手訂定Web Scripting language的標準,這個標準首見於1997年6月所公佈的ECMA-262號白皮書。自此而後,所有的瀏覽器廠商才終於有了一個可以遵循的規格,讓JavaScript的市場接受度向前邁了一大步。
擁有平台優勢的Microsoft原本希望能以VBScript與JavaScript在前端平台上一決高下,可惜市場反應並不如預期。還好,老謀深算的Microsoft很快地改變策略,他的策略很是高竿 -- 「如果不能打敗他,就迎向他」。Microsoft的工程師們在最短的時間內,根據ECMA-262的標準制定了JScript,並且讓不斷推陳出新的瀏覽器工具持續支援JScript版本的更新。靈活的市場策略讓JScript頗具生命力,也開始取得網頁工程師們的喜愛。
截至目前為止,最新的版本是Jscript .NET。各版本與作業平台的關係如下表所示: |
Host Application | 1.0 | 2.0 | 3.0 | 4.0 | 5.0 | 5.1 | 5.5 | 5.6 | .NET | Microsoft Internet Explorer 3.0 | x | | | | | | | | | Microsoft Internet Information Server 3.0 | | x | | | | | | | | Microsoft Internet Explorer 4.0 | | | x | | | | | | | Microsoft Internet Information Server 4.0 | | | x | | | | | | | Microsoft Internet Explorer 5.0 | | | | | x | | | | | Microsoft Internet Explorer 5.01 | | | | | | x | | | | Microsoft Windows 2000 | | | | | | x | | | | Microsoft Internet Explorer 5.5 | | | | | | | x | | | Microsoft Windows Millennium Edition | | | | | | | x | | | Microsoft Internet Explorer 6.0 | | | | | | | | x | | Microsoft Windows XP | | | | | | | | x | | Microsoft Windows Server 2003 | | | | | | | | x | | Microsoft .NET Framework 1.0 | | | | | | | | | x | | 如前所述,既然JavaScript與Jscript都源自於相同的ECMA-262標準,可以想見其中的共同點必定許多。
在筆者的觀察中,從功能面來看,JavaScript可視為Jscript的子集合,因為Jscript除了包含JavaScript所有的特性與物件之外,更引進run-time features,包含以下幾類: |
Category | Feature/Keyword | Collections | Drives Files Folders | Data Storage | Dictionary | Dictionary | Add Exists Items, Keys Remove, RemoveAll Count Item, Key | File System | Drive File FileSystemObject Folder TextStream | FileSystemObject | BuildPath CopyFile, CopyFolder CreateFolder, CreateTextFile DeleteFile, DeleteFolder DriveExists, FileExists, FolderExists GetAbsolutePathName, GetBaseName GetDrive, GetDriveName GetFile, GetExtensionName GetFileName GetFolder, GetParentFolderName GetSpecialFolder GetTempName MoveFile, MoveFolder OpenTextFile Drives | Drive, Drives | AvailableSpace Count DriveLetter DriveType FileSystem FreeSpace IsReady Item RootFolder SerialNumber ShareName TotalSize VolumeName | File, Files Folder, Folders | Add Attributes Copy, Delete, Move Count OpenAsTextStream DateCreated, DateLastAccessed, DateLastModified Drive Item ParentFolder Name, Path ShortName, ShortPath Size | TextStream | Close Read, ReadAll, ReadLine Skip, SkipLine Write, WriteBlankLines, WriteLine AtEndOfLine, AtEndOfStream Column, Line | | 因此,Jscript除了不等於JavaScript之外,他代表的是更為廣泛,也更為成熟的手稿式網頁功能。 |
|