微软的新技术"Fusion"

westsword 2000-08-29 04:23:00
摘自http://www.winsupersite.com/showcase/

Fusion Preview: "Run Once, Run Forever"

Since its inception, code and state sharing has been a key component of Windows. In the early days, primarily, it was also a requirement, as Microsoft's engineers fought to overcome the limited memory and disk space found on early PCs. In fact, Microsoft's first two versions of Windows were tuned to run on floppy-based systems; it wasn't until Windows 3.0 in 1990 that hard drives started to become a de facto component of a Windows system. It's somewhat ironic, given the size and complexity of today's Windows, to consider that the original design of this operating system was inherently thrifty with system resources. And to combat the relatively tiny amount of disk space that would likely be available, the early designers of Windows invented DLLs, or dynamic link libraries, which are files that simply contain code that can be shared between multiple applications and the operating system, simultaneously, so that this code wouldn't need to exist on the system in numerous locations.
DLLs were a good idea for the time. But as Windows grew in complexity and size, DLLs started to wear out their welcome and have increasingly become a key source of system instability. The problem has to do with version conflicts: Each DLL is updated with new functionality over time, with newer versions providing (hopefully) a superset of the functionality of earlier versions. To ensure that their applications have the correct versions of DLLs, software developers would ship these DLLs with their applications and install them on a system when the application was installed. Properly written applications will, of course, check to ensure that they are not overwriting a newer version, but this doesn't always happen and, perhaps more disconcertingly, newer versions of DLLs aren't always completely backwards compatible with earlier versions.

The end result to this mess is "DLL hell," a condition all Windows users are familiar with though they might not no it by name: You install an application that causes Windows not to boot, perhaps, or a previously working application suddenly refuses to run. Microsoft acknowledges the problem and has been working to fix it since Windows 3.1, but with the runaway success of 32-bit versions of Windows such as Windows 9x and NT/2000, and the complexity that these systems bring to the table, DLL hell has only gotten worse over the years.

Today, the fragility of a Windows system can be tied directly to problems associated with DLL hell and the fact that Windows systems are inherently complex at the code level. But DLL hell isn't the only issue, though it's a convenient name for a boogeyman we all know and understand. Sharing at other levels--such as COM objects and device drivers--also contributes to the underlying fragility of Windows. Internally, Microsoft describes the problem like so:

DLL Hell is not just about DLLs. It抯 about sharing. It抯 about sharing code in the form of DLLs, COM objects, device drivers. It抯 about sharing state in the form of the registry or ad-hoc stores built on top of the file-system. It抯 about the complexity of a system that shares almost everything and can抰 truly be tested the way that we used to test it. It抯 about a market that leaves little for second place products and forces companies to ship as rapidly as possible, before complexity is understood and before problems can be found and fixed. . Sharing is the glue that binds the various dimensions of complexity together. We need to make it possible to selectively break the bonds.

After almost a decade of study, Microsoft has come to the conclusion that sharing is a double-edged sword, with benefits and associated problems that are difficult to reconcile. And though it might be easier to simply fix this problem in tandem with a future platform shift, the problem is severe enough that customers need a fix now, on the current Windows platform. So the company began implementing a series of technologies, over time, that addresses this problem. And those technologies are lumped under the name "Fusion," an internal code-name that Microsoft has never publicly discussed. What's amazing about this technology is that we've already seen three basic examples that were developed under the Fusion umbrella, it's just that we didn't understand that that's what they were. But for Fusion, as Microsoft likes to say, the best is yet to come, and future versions of Fusion may actually solve the DLL hell problem once and for all. But before we get to that, let's take a look at the evolution of Fusion and see where it's taken us so far.

Fusion 1.0: Side-by-side DLLs and Windows File Protection
The first Fusion technology that saw the light of day is "side-by-side DLLs," which debuted with Windows 98 Second Edition in mid-1999. This essentially allows an applications developer to rename system DLLs and make them available in a separate, private location. For example, a developer may need a particular version of COMCTL32.DLL, which typically exists in the SYSTEM or SYSTEM32 folder of a 32-bit Windows system. Rather than replace the version of this DLL that's found in Windows, and foist potential incompatibilities on other applications or even Windows itself, the developer could simply rename the correct version of this DLL and provide it somewhere under the directory structure created to house his application. Then, when the application needed the services of the DLL, it would call the private version. But the operating system and other applications could continue to use the "public" version and there wouldn't be any conflicts.

This is a decent solution to the problem, with one major caveat: It's optional, and the applications developer must manually provide this feature. Still, this itself wouldn't be a kiss of death but for one other issue: It only works on Windows 98 SE (not 95 or the original version of 98) or newer (and on Windows 2000 or newer, but not NT). So anyone implementing this feature would be ignoring the vast majority of the market, as most Windows users aren't yet using the latest and greatest versions. Of course developers could opt to include this feature on systems that were running 98 SE or newer and simply behave normally on legacy Windows systems, but that's a lot of extra work for a relatively small segment of the user base. And it ignores the very basic fact that DLL hell is a problem with Windows and something that should logically be fixed by Microsoft, not by third-party software developers on an application-by-application basis.

In Windows 2000, Microsoft released a second technology that might be considered part of Fusion 1.0, Windows File Protection (WFP). In Windows 2000, Windows File Protection prevents the replacement of protected system files (Specifically, certain .sys, .dll, .ocx, .ttf, .fon, and .exe files) by errant applications. So it's impossible for a poorly written application to install an older version of a key system file on Windows 2000. However, service packs, hot fixes, Windows Update, and other operating system updates can overwrite key system files with newer versions. This feature was also made available in Windows Millennium Edition ("Windows Me"), where it is known as System File Protection (SFP).

Windows File Protection is a good feature and it does work to increase reliability and stability on the Windows 2000 platform. But Windows File Protection does so at the risk of breaking application compatibility: There are numerous instances of newer DLLs not working with older applications that expect a different version. This was a conscious trade-off, of course, and one that Microsoft was quite open about during the development of Windows 2000. But many applications simply won't run on Windows 2000 until they are upgraded to work with the updated DLLs and other system files that are found on that OS. And WFP has another liability: Microsoft has given away the "keys" to WFP by supporting something called "exception packs" so that updated DLLs that are installed on an NT 4.0 system which has been upgraded to Windows 2000 can be migrated to the new OS. This means that a system upgraded to Windows 2000 may be inherently broken from day one, despite WFP.

Going forward, Microsoft wants to create an environment in which legacy applications will continue to install and run correctly, while providing a more elegant platform for new applications that will adhere to new installation and co-existence guidelines. Future versions of Fusion enable just this.

Fusion 2.0: Protecting the Server
First up is Fusion 2.0, technologies that will first be made available with Visual Studio 7 and COM+ 2.0 (both expected in. Q1 2001). And as you might expect, given the products with which this technology will become available, Fusion 2.0 will deal largely with protecting COM+ 2.0 components, on both Web browser clients and the server, from each other, and with protecting the operating system from these COM+ components. Microsoft shipped COM+ 1.0 with Windows 2000 in early 2000; COM+ 2.0 will be available as an add-on to Windows 2000 and it will also ship with Whistler, the follow-up to Windows 2000 due in the first half of 2001. Improvements in this release are geared largely toward Web servers.

Fusion 2.5: Protecting Consumers
Later in 2001, Microsoft will ship its Fusion 2.5 technologies in "Whistler," the follow-up to Windows 2000. Whistler is what Microsoft calls a "Fusion-enabled componentized OS that will provide device driver and OS install/update reliability." With the release of Fusion 2.5 in Whistler, Microsoft will support protected and isolated COM+ 2.0, COM classic, and Win32 components. The focus with this release will be consumer needs, and it's expected that Whistler will usher in a more transparent form of protection for components, including legacy components that don't know about the presence of the feature.

How Fusion works
To counter the problematic side effects of sharing, Microsoft will use Fusion technologies to introduce isolation to Windows. Applications and components, for example, which were written with the assumption that they would share system resources, will automatically be isolated from the rest of the system transparently. That is, they will install as normal, and to the user, nothing changes. But the OS will actually be copying the shared DLLs and other files that the application installs into a private location, so that the application will "think" that it is running normally, as it would on a legacy Windows system. But on Whistler, that application will really be running in a psuedo-clean virtual machine, one in which it is the only installed application. It will be unable to break other applications or the OS.

For new applications, the picture is even brighter. Application installation, maintenance, and removal will be simpler and largely automatic. For the user, setup, concepts like drives and directories, and reboots because of application install will disappear. New installs won't break other applications or the OS, something that will be equally important in the new service-based application model that Microsoft is pushing with Next Generation Windows Services (NGWS). When Whistler is updated with new features and bug fixes, these changes to the system will be safe and incremental. And though this is still up in the air, these features are technically possible to implement on existing Win32 platforms, so there's a chance that Microsoft will retroactively add some Fusion 2.5 technologies to Windows 2000 or even Windows Me. I won't be holding my breath, of course.

To describe the physical makeup, exposed entry points, and dependencies of an application or component, Microsoft is introducing the concept of a manifest that will make these bits self-documenting to the underlying OS. So the manifest is a blueprint, or database, that describes the application or component. This information, which is typically lost during today's installation phase, will be stored by the system to ensure that the application or components always executes correctly. For example, when an application requires a particular version of a dependency (typically a DLL), the system will ensure that the application always uses that version of the DLL when it runs. So an application (or component) will always run in a known correct state. The manifest provides a number of other benefits, however. Setup will be simplified and the system can proactively cache code on demand and delete code that is never used. And the repair of broken applications will be dramatically simplified because the system will always known what the application needs to run correctly.

Incidentally, Microsoft is going to use XML to represent its application manifests. A working group within the company made up of members of the Fusion, IE, COM+, IIS and WBEM teams is currently determining the structure of the manifest and the way that this information will be made available. For example, one question regards the physical location of an application's manifest: Should it somehow be incorporated in binary form into the application's executable file? Or should it be entered into the Registry or other disk-based database?

Conclusion
Windows is fragile today largely because of the code and state sharing features that are fundamental to the architecture of the OS. Microsoft is working to solve this problem by adding code and state isolation to the underlying operating system in a form that will work with legacy applications as well as new applications that have a better understanding of this feature. So in Whistler, sharing will become the exception rather then the default, as it's been in Windows since 1985. Features such as self-repair and self-diagnosis, provided by a new manifest feature, will enable applications, and thus Windows itself, to be more reliable. And installation and maintenance will be much simpler as a welcome side benefit of this new architecture. So, with apologies to Sun Microsystems, Whistler will enable applications that run once to run forever.

--Paul Thurrott
May 4, 2000


--------------------------------------------------------------------------------
?2000 Duke Communications International, Inc. All rights reserved.



...全文
211 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzroom 2001-05-11
  • 打赏
  • 举报
回复
谁能将它译成中文?
我国GIS经过三十多年的发展,理论和技术日趋成熟,在传统二维GIS已不能满足应用需求的情况下,三维GIS应运而生,并成为GIS的重要发展方向之一。上世纪八十年代末以来,空间信息三维可视化技术成为业界研究的热点并以惊人的速度迅速发展起来,首先是美国推出Google Earth、Skyline、World Wind、 Virtual Earth、ArcGIS Explorer等,我国也紧随推出了EV-Globe 、GeoGlobe、VRMap、IMAGIS等软件与国外软件竞争本土市场。三维GIS得到了各行业用户的认同,在城市规划、综合应急、军事仿真、虚拟旅游、智能交通、海洋资源管理、石油设施管理、无线通信基站选址、环保监测、地下管线等领域备受青睐。目前,我国国产三维GIS软件已占据了国内市场的半壁江山。   本文唱谈了十九个国内外主流的三维GIS软件,并对其基本特点、发展历程、应用等方面做了总结概述。由于作者水平有限,不足之处恳请读者批评指正。   国外三维GIS软件:   一重唱·美国谷歌公司:Google Earth--用户最多的三维地球软件   介绍:Google Earth以三维地球的形式把大量卫星图片、航拍照片和模拟三维图像组织在一起,使用户从不同角度浏览地球。Google Earth的数据来源于商业遥感卫星影像和航片,包括DigitalGlobe公司的QuickBird,IKOONOS及法国SPOTS。   特点:Google Earth凭借其强大的技术实力和经验,以其操作简单、用户体验超群的优势吸引了全球近十分之一的人口使用。   发展历程:Google于2004年10月收购了Keyhole公司,随之次年6月推出Google Earth系列软件。   产品形式:Google Earth客户端软件提供三个版本:个人免费版、Plus版、Pro版以及企业级解决方案,用于在企业内部部署Google Earth应用。   二重唱·美国国家航空和航天管理局(NASA):World Wind--最强大的开源地理科普软件   介绍:World Wind是NASA发布的一个开放源代码的地理科普软件,由NASA Research开发,NASA Learning Technologies来发展,它是一个可视化地球仪,将NASA、USGS以及其它WMS服务商提供的图像通过一个三维的地球模型展现,还包含了火星和月球的展现。软件用C#编写,调用微软SQL Server影像库Terrain Server来进行全球地形三维显示。它通过将遥感影像与SRTM高程(航天飞机雷达拓扑测绘)叠加生成三维地形。   特点:World Wind最大的特性是卫星数据的自动更新能力。这种能力使得World Wind具有在世界范围内跟踪近期事件、天气变化、火灾等情况的能力。   拥有NASA血统的World Wind可以利用Landsat 7、SRTM、MODIS、GLOBE , Landmark Set等多颗卫星的数据,将Landsat卫星的图像和航天飞机雷达遥感数据结合在一起,让用户体验三维地球遨游的感觉。采用了先进的流传输技术。   World Wind是个完全免费的软件,在使用上没有任何限制,主要面向科学家、研究工作者和学生群体。另外World Wind是完全开放的,用户可以修改World Wind软件本身。目前,包括国内部分三维GIS软件在内的全球许多主流三维软件都是以World Wind为技术内核发展而来。   三重唱·美国Skyline公司:Skyline Globe--个性化的三维地理信息系统   介绍:SkylineGlobe产品能够基于地表的卫星影像、航空影像创建高分辨率的三维虚拟地球场景。Skyline具有强大空间信息展示功能,支持交互式绘图工具,提供三维测量及地形分析工具,提供数据库接口支持如Oracle,ArcSDE,拥有强大数据处理能力。   特点:Skyline Globe Enterprise Solution是美国Skyline公司为网络运营三维地理信息提供的企业级解决方案。包括了Skyline整套软件工具,给客户提供一站式服务,并开放了所有的API,不论是在网络环境中还是单机应用,让用户能够根据自己的需求定制功能,建立个性化的三维地理信息系统。   产品形式:TerraExplorer、TerraExplorer Pro、TerraBuilder、TerraGate。   应用:中国数字海洋系统、公安部警卫基础工作信息系统、数字深圳三维平台、黄河可视化防汛预案管理系统、数字烟台三维城市规划信息系统等。   四重唱·美国微软公司:Virtual Earth--可以在浏览器中直接运行的三维地球软件   介绍:Virtual Earth 3D可以呈现完整交互式的三维图片,是基于地图的搜索工具,集航拍照片、地图、黄页数据于一体。在Virtual Earth 3D中,就象在大型3D游戏的虚拟现实环境中一样,用户可以在城市之间、建筑物之间“飞来飞去”。除了真实地“再现”城市的地形外,Virtual Earth 3D中也包含一些现实世界中不存在的东西。   特点:Virtual Earth 3D不要求用户在硬盘上下载应用软件,而是直接在浏览器中运行。   发展历程:在Google宣布推出Google Earth后,微软也紧跟其后启动了相关计划。2005年12月23日,微软公司收购一家从事三维地球研究的华人公司GeoTange。2006年5月3日,又收购一家专门从事遥感领域研究的公司Vexcel。随后,在2006年11月初微软发布了Virtual Earth 3D。今年6月,微软推出Bing搜索后,意味着原来的“Virtual Earth”变成了“Bing Maps and Bing Maps for Enterprise”。   五重唱·美国环境系统研究所公司(ESRI): ArcGIS Explorer--ArcGIS家族的3D后代   介绍:ArcGIS Explorer是一个免费的虚拟地球浏览器,提供自由、快速的2D和3D地理信息浏览,充满趣味性且简捷易用。ArcGIS Explorer通过继承ArcGIS Server完整的GIS性能(包括空间处理和3D服务),达到整合丰富的GIS数据集和服务器空间处理应用的目的。   特点:AreG1S Explore具有和Google Earth相似的功能,支持来自ArcGIS Server、GML、WMS、Google Earth(KML)的数据。   发展历程:ArcGIS Explorer是2006年8月推出。在明年即将发布的ArcGIS9.4中也将加强三维GIS功能。 间奏曲   国内三维GIS产品:   六重唱·北京国遥新天地信息技术有限公司:EV-Globe--国内三维海量空间信息平台佼佼者   介绍:EV-Globe具有大范围的、海量的、多源的数据一体化管理和快速三维实时漫游功能,支持三维空间查询、分析和运算,可与常规GIS软件集成,可方便快速构建三维空间信息服务系统,亦可快速在二维GIS系统完成向三维的扩展。EV-Globe提供距离测量、线段剖面、折线剖面、区域淹没、通视分析等三维GIS特色的空间分析功能。可以在EV-Globe中看到烟雾、尘暴、火焰以及下雨、下雪等特殊效果。   特点:EV-Globe基于组件式开发,所有功能以控件或类的方式封装在dll中,用户可以很方便进行各种功能定制,甚至将EV-Globe嵌入各类信息系统中。EV-Globe具备在普通PC机上就能实现的海量三维模型和影像流畅地进行各项漫游操作的功能。此外在EV-Globe服务器端,用户可根据需要绑定常规GIS平台如SuperMap,ArcGIS等。   发展历程:EV-Globe于2008年12月、2009年5月、7月分别发布了EV-Globe SDK、EV-Globe Sea和EV-Globe Web版,并将于今年12月3日正式发布EV-Globe 2.0。   产品形式:EV-Globe SDK(开发包)、EV-Globe Pro(数据浏览工具)、EV-Globe Creater(数据制作工具)、EV-Globe Datasets(影像数据集)。   应用:全国海岛海岸带三维可视化信息系统、中石油海外应急系统、中国石油中长期油气管网建设预测分析、宁波镇海环保三维影像浏览系统、遨游天府--四川省地理空间三维管理系统。   七重唱·武大吉奥信息技术有限公司:GeoGlobe--加入实时三维量测功能   介绍:GeoGlobe是武汉大学李德仁和龚建雅等教授花了近10年时间打造,由武汉大学测绘遥感信息工程国家重点实验室研发的网络环境下全球海量无缝空间数据组织、管理与可视化软件。GeoGlobe提供了一系列三维可视化及应用的功能:可视化导航与操作、可视化查询与三维分析、兴趣点标注及定位等。还提供了二次开发功能,用户可以根据应用的需要自行设计界面,调用所提供的动态库进行二次开发。   特点:GeoGlobe具有和World Wind相似的功能,加入了实时三维量测等功能。能同时处理多种来源的数据,包括三维地形图、航拍影像图、三维模型,矢量数据,是Google Earth所没有的。GeoGlobe2.0提供了海量4D数据(DEM、DOM、DLG、DRG)、地名数据、三维模型数据的完整解决方案。   发展历程:GeoGlobe于2006年4月推出,现已推出至GeoGlobe2.0。   产品形式: GeoGlobe Server、GeoGlobe Builder、GeoGlobe Viewer。   八重唱·适普软件有限公司:IMAGIS--管理意义上的“所见即所得”   介绍:IMAGIS三维可视地理信息系统是一套以数字正射影像(DOM)、数字地面模型(DEM)、数字线划图 (DLG)和数字栅格图 (DRG)作为处理对象的 GIS 系统。结合了三维可视化技术与虚拟现实技术,完全再现管理环境下的真实情况,把所有管理对象都置于一个真实的三维世界中,真正做到了管理意义上的“所见即所得”。   特点:IMAGIS在数据管理上采用了矢量数据和栅格数据混合管理的数据结构,二者可以相互独立存在,同时,栅格数据也可以作为矢量数据的属性,以适应不同情况下的要求。   发展历程:2003年3月推出IMAGIS V2.3,2004年6月推出增强版本IMAGIS V2.3.6,并在该版本中正式推出IMAGIS Web3D V1.0 中英文版本。   产品形式:   IMAGIS Education:三维可视地理信息系统教育版;   IMAGIS Classic:三维可视地理信息系统;   IMAGIS Magixity:城市建模与可视化地理信息系统;   IMAGIS 3DBrowser:影像快速漫游系统;   IMAGIS Web3D:三维场景数据网络发布系统;   IMAGIS Sup3DBrowser:3DBrowser 通用控件。   九重唱·伟景行数字城市科技有限公司:CityMaker--数字城市的三维应用   介绍:CityMaker 是数字城市三维可视化平台,主要针对城市规划领域,提供覆盖规划设计、展示、评估、管理的全方位服务。提供从三维地理信息系统建设到应用的全面解决方案。通过CityMaker三维地理信息平台,可以叠加显示城市面貌、规划图则、户籍信息、监控视频等各种二三维数据,还可快速集成已有专业系统,开展基于网络的三维专业应用。   特点:是面向规划设计师和建筑师的三维辅助设计软件,它将虚拟可视化技术融入设计过程,让设计师在三维环境下进行城市的设计、评估、分析和交流。它可以与3ds MAX等建模软件配合使用,支持材质编辑和物体运动编辑,支持火焰、喷泉、爆炸和雨雪等虚拟现实效果的制作等。   产品形式:   CityMaker Network:专业的城市级三维地理空间信息网络应用平台;   CityMaker Professional:专业的城市规划三维分析软件;   CityMaker Builder:城市级三维地理空间创建软件平台;   CityMaker Designer:面向规划设计师和建筑师的三维辅助设计软件;   CityMaker Simulation System:专业的多通道三维模拟仿真软件。   应用:数字北京、数字斯图加特、虚拟圆明园、上海世博会虚拟现实系统等。   十重唱·杭州阿拉丁信息科技股份有限公司:AlaGIS--网络仿真城市E都市的同门   介绍:AlaGIS与全球首个大规模网络仿真城市E都市同属于杭州阿拉丁公司,采用面向网络的分布式空间信息应用服务支撑平台,集二维、三维、遥感影像于一体,全面整合了GIS与数据库、软件工程、人工智能、网络技术及其他多种计算机主流技术。   特点:二三维叠加是AlaGIS的主要特点,AlaGIS平台采用的合理的二三维映射使二维图形和三维图形的数据一一对应,从而实现了二维图形和三维图形的有效结合,通过二三维的切换或者透明度变化来达到所期望的图形效果。   应用:三维地名管理系统、三维警务地理信息系统、三维数字房产管理系统、三维税源网络管理系统、三维旅游展示管理平台等。   十一重唱·北京灵图软件技术有限公司:VRMap--首次在微机上再现真三维景观   介绍:三维地理信息系统软件VRMap实现了VR和GIS技术的完美结合,可以根据卫星影像、航空影像、电子地图、高程数据、城市模型数据、虚拟效果数据生成虚拟地理场景;通过VRMap提供的二次开发包,可实现规划、国土、电信、交通、水利等各行业的专业分析。   特点:VRMap采用J2EE体系架构,快速、灵活构建基于Web的三维业务应用系统;同时VRMap提供城市级别的基于网络的海量精细场景,可快速建立三维应用。   发展历程:从2000年诞生的VRMap1.0至今,VRMap产品已升级到4.0。但是受2007年底灵图公司裁员事件影响,原VRMap团队成员流失较为严重,产品后续发展堪忧。   产品形式:VRMap标准版、VRMap专业版、VRMap企业版。   十二重唱·北京海澄华图科技有限公司:NEOMAP VPlatform--灵图VRMap的变身   介绍:NEOMAP VPlatform的简称是NVP,它可以在网络发布全球高精度DEM/DOM/DLG数据和特大城市级三维精细模型。NVP提供服务接口,支持灵活的二次开发和二三维一体化应用。NVP包含三维数据处理、三维场景整合、三维网络服务平台、三维数据浏览、运维支撑、二次开发SDK共六个子系统。   特点:NVP的多项核心技术,包括高效的海量空间数据管理技术、海量三维数据网络发布技术、地形、影像数据存储压缩技术、多精度地形、影像数据融合技术,处于国内外领先水平,在对于三维GIS系统最重要的海量数据支持、稳定性、二次开发支持、三维效果方面有显著优势。   发展历程:2008年8月成立公司,随即推出NEOMAP VPlatform。   产品形式:三维数据处理、三维场景整合、三维网络服务平台、三维数据浏览、运维支撑、二次开发SDK。   应用:数字延吉城市地理信息共享平台、苏州市基础地理信息共享平台、青岛市南区空间信息服务平台及应用、秦皇岛城市管理局。   十三重唱·中国资源卫星应用中心、北京视宝卫星图像公司、北京星天地信息科技公司:数据地球(中国)--卫星、航空、地面三种采集方式的集成   介绍:数据地球(中国)(Data Earth China)是我国第一个集数据与软件一体化的三维地理空间信息系统,它在国家863计划地球观测与导航技术领域项目支持下,由中国资源卫星应用中心、视宝公司和北京星天地公司三家联合研发的新一代自主产权的三维地理空间信息服务平台,标志着我国已拥有基于卫星、航空、地面三种方式采集到的地理信息综合开发而成的三维立体地理空间信息系统。   特点:该平台集成了国内领先的Uniscope三维GIS引擎技术,覆盖全域的高分辨率卫星影像(CBERS-02B、SPOT5)、较高精度的地形高程数据、导航用道路和POI等矢量信息,符合保密规定的政府用户还可以享受航空影像数据服务,是数据和平台,航天和航空、宏观和微观、矢量和栅格相结合的新一代三维地理信息产品。   发展历程: 2009年9月发布。   应用:城市应急指挥、国防信息化建设、国土资源管理、城市规划、环境保护、灾害防治等。   十四重唱·武汉地大信息科技发展有限公司:InfoEarth TelluroMap--三维应用系统集成   介绍:InfoEarth TelluroMap采用面向Internet的分布式计算技术和三维可视化技术,支持跨区域、跨网络的复杂大型网络三维应用系统集成。为海量三维空间数据的发布提供了可扩展的开发平台,开发者可以方便、灵活地实现网络空间数据的共享和三维可视化。   特点:InfoEarth TelluroMap基于主流技术平台。NET开发,产品开放性好、架构灵活、三维功能和GIS功能强大、支持TB级海量空间和三维模型数据发布和应用。   产品形式:   InfoEarth TelluroMap Server:服务器端应用程序和组件库;   InfoEarth TelluroMap GlobeEngine:基于组件技术的三维可视化组件;   InfoEarth TelluroMap Map:基于Ajax的WebGIS客户端组件;   InfoEarth TelluroMap Fusion:空间数据、三维模型数据入库、预处理模块。   应用:数字汉江、数字地大、移动基站三维地理信息系统设计方案、山洪(灾害)预警系统工程解决方案等。   十五重唱·北京朝夕科技有限责任公司:Drawsee Earth--在线开发的三维地理信息系统   介绍:Drawsee Earth是结合三维和网络技术的互联网三维GIS开发平台,构建企业级B/S结构三维行业应用的工具。它基于Microsoft .NET与ActiveX软件平台,通过海量数据管理、网络数据流传输、三维模型高速显示等技术,把卫星影像、数字高程、普通矢量地图、精细建筑模型等数据融合到一起。   特点:Drawsee Earth不仅可以提供三维场景可视化、海量数据管理,而是结合行业,提供三维场景动态模拟分析。将三维场景各类实体的可预见态势、不可预见态势,通过动态分析真实展现出来。   产品形式:   Drawsee EarthDesk:数据融合工具;   Drawsee EarthServer:数据服务器;   Drawsee EarthViewer:客户端插件。   应用:三维森林防火指挥系统、三维油罐监控系统、互联网3DGPS车辆监控系统等。   十六重唱·北京超维创想信息技术有限公司:Creatar --真三维地学信息系统   介绍:Creatar 1.0三维地学信息系统是超维创想公司基于北京大学科研实力进行技术创新,自主研发的新一代真三维地学信息系统系列软件。该软件是我国第一个参加科技部软件测评的真三维地学信息系统软件。   特点:完善的三维空间信息基础服务、开放的系统平台、多应用模式支持。   应用:城市地质、岩土工程、环境地质、矿产资源勘查等众多地学相关领域。   十七重唱·北京超图软件股份有限公司:SuperMap iSpace--二三维一体化的三维 GIS模块   介绍:SuperMap iSpace是SuperMap UGC新增三维GIS模块的产品研发代号。采用了SuperMap SDX+空间数据库技术来高效地、一体化地存储和管理二维三维空间数据,升级了二维显示的功能,不仅能够支持将二维的GIS数据和地图直接加载到真三维场景中进行显示,而且可以在二维窗口中显示三维数据,在二维地图中使用三维符号,真正实现了二维三维数据一体化。   特点:二维三维数据一体化、多元数据无缝集成、多元数据无缝集成、三维web浏览等;提供基本的三维空间分析能力包括:量算分析、查询统计分析、通视性分析。   发展历程:2009年10月在超图用户大会上宣布,但目前尚未看到成熟的产品。   十八重唱·中地数码集团:MapGIS-TDE--地上、地表、地下的三维空间数据模型   介绍:MAPGIS-TDE 三维处理平台是中地公司在 MAPGIS7.0 中推出的一套支持真三维数据处理及3DGIS 应用项目二次开发平台。采用三维空间数据模型、构模算法、三维可视化技术及框架加插件的软件体系结构,具备集成管理地上、地表、地下的三维空间模型的能力,可以管理从2.5维到3维、从矢量到栅格等多种三维空间数据模型,并提供多种模型建立、管理及显示的工具及接口。   特点:MAPGIS-TDE在提供一般三维空间数据模型及其管理功能的基础上,平台允许针对特定应用领域动态扩展建模及其分析功能插件,以适应特定的三维应用。   应用:MAPGIS三维数码景观系统、MAPGIS 工程勘察信息系统、MAPGIS 城市地质信息系统、MAPGIS 综合管网信息系统等。   十九重唱·广州市红鹏直升机应用服务有限公司:真三维地理信息系统--航空摄影测量的延伸   介绍:红鹏真三维地理信息系统是以普通数字地图数据为基础,利用虚拟现实技术,将高程数据用形象的方式表现出来;同时运用多媒体和三维可视化技术将图形、图像、文字和数据纳入统一的窗口系统下管理,使其具有虚拟、动态、交互等特征。   特点:红鹏真实三维数字地图不同于其它城市虚拟仿真系统,而是利用其自身优势,从低空(300米)获取高分辨率的航空影像。同时,高分辨率的航空影像也有助于量测出精准的城市建筑的空间尺度。三维数字地图的平均误差不超过1.5 米。利用航空摄影测量的方式,可以快捷、准确、低成本地构建大范围的城市三维地图。 尾声   技术的进步和用户需求的拉动在GIS从二维向三维的发展中起到了决定性的作用。GIS的三维时代,已经悄然来临并广泛应用发展。随着计算机与空间技术的进步与发展, GIS 将由各自分开独立的系统走向兼容与集成;由二维走向三维和四维, 由单机走向网络, 并最终走向社会和家庭。
摘 要

本论文主要从三部分讲述了如何在微软技术平台上建立网上商店。第一部分包括电子商务的需求分析、系统的应用环境、网站的总体设计。第二部分对网站的前台和后台进行了分析和设计。第三部分是对网站的功能测试。
本文着重讲述了在Windows操作系统IIS环境上运用ASP与SQL Server 2000数据库开发“网上销售系统”所实现的主要功能,包括会员管理、商品的分类与查询、商品热卖、浏览排行、查询关键字排行、购物车、收银台、订单、后台管理、商品管理、订单管理、网站投票管理、网站信息管理、网站统计信息等内容。分别在论文的第一部分介绍了网上销售系统的需求分析,系统的开发环境,网站的结构设计,网站功能模块的划分,网站的工作流程,数据库的设计与实现。论文的第二部分对网站进行了详细的系统设计与讨论,包括对前台系统和后台系统功能的详细划分并对其功能做了详细的介绍,列出了一些主要代码和流程图。在第三部分对与网站所存在的风险和问题进行了说明,并阐诉了网站测试的主要流程。

关键词:ASP;数据库;网上销售系统


Abstract

Since has entered the for 1990s,along with computer technology, communication flourishing more and more daily with the fusion,the Internet popularization application, one kind of brand-new commercial form --- electronic commerce, took in particular in the commercial trade domain one advanced transaction way, the whole world is being all the rage, and has the huge influence to in this domain tradition idea and the behavior way.
Now, the people already proposed realizes through the Internet network from the commercial information obtains, the commodity demonstration, the transaction until the electronic currency payment, the post-sale service and so on a series of integrity electronic commerce concept.



目 录

前 言 ……………………………………………………………………………………… 1
第1章 系统分析……………………………………………………………………………2
1.1 需求分析………………………………………………………………………………2
1.2 系统应用环境…………………………………………………………………………3
1.2.1 ASP简介…………………………………………………………………………3
1.2.2 Internet信息服务器简介 ……………………………………………………… 3
1.2.3 ADO简介…………………………………………………………………………3第2章 网站结构设计……………………………………………………………………… 4
2.1 网站功能描述 ……………………………………………………………………… 4
2.2 功能模块划分 ……………………………………………………………………… 5
2.3 网站流程分析 ……………………………………………………………………… 5
第3章 数据库设计与实现…………………………………………………………………7
第4章 网站前台系统开发……………………………………………………………… 11
4.1 会员管理…………………………………………………………………………… 11
4.1.1 注册新会员…………………………………………………………………… 11
4.1.2 用户登录……………………………………………………………………… 11
4.1.3 取回忘记的密码……………………………………………………………… 12
4.1.4 修改用户资料………………………………………………………………… 12
4.2 商品分类和查询…………………………………………………………………… 13
4.2.1 商品分类的实现……………………………………………………………… 13
4.2.2 显示商品详细信息…………………………………………………………… 14
4.2.3 商品查询……………………………………………………………………… 15
4.3 购物车……………………………………………………………………………… 15
4.3.1 购物车的工作流程…………………………………………………………… 15
4.3.2 向购物车中添加商品………………………………………………………… 16
4.3.3 显示购物车信息……………………………………………………………… 17
4.4 收银台……………………………………………………………………………… 18
4.4.1 填写送货资料………………………………………………………………… 18
4.4.2 订单确认……………………………………………………………………… 18
4.5 订单………………………………………………………………………………… 19
4.6 网站调查…………………………………………………………………………… 20
4.7 信息统计…………………………………………………………………………… 20
4.8 投诉建议…………………………………………………………………………… 20
第5章 网站后台系统开发……………………………………………………………… 21
5.1 后台系统设计流程………………………………………………………………… 21
5.2 用户管理系统 ………………………………………………………………………22
5.3 商品管理…………………………………………………………………………… 23
5.3.1 商品分类管理………………………………………………………………… 23
5.3.2 商品管理……………………………………………………………………… 24
5.4 订单管理…………………………………………………………………………… 26
5.5 网站信息管理……………………………………………………………………… 27
5.5.1 投票管理……………………………………………………………………… 27
5.5.2 查看意见反馈………………………………………………………………… 28
5.5.3 商品专题管理………………………………………………………………… 28
5.6 报表统计…………………………………………………………………………… 29
第6章 网站测试………………………………………………………………………… 30
6.1 测试的部署………………………………………………………………………… 30
62 网站负荷测试……………………………………………………………………… 30
结论………………………………………………………………………………………… 31
致谢………………………………………………………………………………………… 32
参考文献…………………………………………………………………………………… 33
附录

jQuery1.2 API 中文版折叠展开折叠全部展开全部 英文说明 核心jQuery 核心函数 jQuery(expression,[context]) jQuery(expression,[context]) 这个函数接收一个包含 CSS 选择器的字符串,然后用这个字符串去匹配一组元素。 jQuery 的核心功能都是通过这个函数实现的。 jQuery中的一切都构建于这个函数之上,或者说都是在以某种方式使用这个函数。这个函数最基本的用法就是向它传递一个表达式(通常由 CSS 选择器组成),然后根据这个表达式来查找所有匹配的元素。 默认情况下, 如果没有指定context参数,$()将在当前的 HTML 文档中查找 DOM 元素;如果指定了 context 参数,如一个 DOM 元素集或 jQuery 对象,那就会在这个 context 中查找。 参考 Selectors 获取更多用于 expression 参数的 CSS 语法的信息。 -------------------------------------------------------------------------------- This function accepts a string containing a CSS selector which is then used to match a set of elements. The core functionality of jQuery centers around this function. Everything in jQuery is based upon this, or uses this in some way. The most basic use of this function is to pass in an expression (usually consisting of CSS), which then finds all matching elements. By default, if no context is specified, $() looks for DOM elements within the context of the current HTML document. If you do specify a context, such as a DOM element or jQuery object, the expression will be matched against the contents of that context. See Selectors for the allowed CSS syntax for expressions. 返回值 jQuery 参数 expression (String) : 用来查找的字符串 context (Element, jQuery) : (可选) 作为待查找的 DOM 元素集、文档或 jQuery 对象。 示例 找到所有 p 元素,并且这些元素都必须是 div 元素的子元素。 HTML 代码:

one

two

three

jQuery 代码: $("div > p"); 结果: [

two

] -------------------------------------------------------------------------------- 在文档的第一个表单中,查找所有的单选按钮(即: type 值为 radio 的 input 元素)。 jQuery 代码: $("input:radio", document.forms[0]); -------------------------------------------------------------------------------- 在一个由 AJAX 返回的 XML 文档中,查找所有的 div 元素。 jQuery 代码: $("div", xml.responseXML); jQuery(html)jQuery(html) 根据提供的原始 HTML 标记字符串,动态创建由 jQuery 对象包装的 DOM 元素。 你可以传递一个手写的 HTML 字符串,或者由某些模板引擎或插件创建的字符串,也可以是通过 AJAX 加载过来的字符串。但是在你创建 input 元素的时会有限制,可以参考第二个示例。当然这个字符串可以包含斜杠 (比如一个图像地址),还有反斜杠。当你创建单个元素时,请使用闭合标签或 XHTML 格式。例如,创建一个 span ,可以用 $("") 或 $("") ,但不推荐 $("") -------------------------------------------------------------------------------- Create DOM elements on-the-fly from the provided String of raw HTML. You can pass in plain HTML Strings written by hand, create them using some template engine or plugin, or load them via AJAX. There are limitations when creating input elements, see the second example. Also when passing strings that may include slashes (such as an image path), escape the slashes. When creating single elements use the closing tag or XHTML format. For example, to create a span use $("") or $("") instead of without the closing slash/tag. 返回值 jQuery 参数 html (String) : 用于动态创建DOM元素的HTML标记字符串 示例 动态创建一个 div 元素(以及其中的所有内容),并将它追加到 body 元素中。在这个函数的内部,是通过临时创建一个元素,并将这个元素的 innerHTML 属性设置为给定的标记字符串,来实现标记到 DOM 元素转换的。所以,这个函数既有灵活性,也有局限性。 jQuery 代码: $("

Hello

").appendTo("body"); -------------------------------------------------------------------------------- 创建一个 元素必须同时设定 type 属性。因为微软规定 元素的 type 只能写一次。 jQuery 代码: // 在 IE 中无效: $("").attr("type", "checkbox"); // 在 IE 中有效: $(""); jQuery(elements)jQuery(elements) 将一个或多个DOM元素转化为jQuery对象。 这个函数也可以接收XML文档和Window对象(虽然它们不是DOM元素)作为有效的参数。 -------------------------------------------------------------------------------- Wrap jQuery functionality around a single or multiple DOM Element(s). This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements). 返回值 jQuery 参数 elements (Element, Array) : 用于封装成jQuery对象的DOM元素 示例 设置页面背景色。 jQuery 代码: $(document.body).css( "background", "black" ); -------------------------------------------------------------------------------- 隐藏一个表单中所有元素。 jQuery 代码: $(myForm.elements).hide() jQuery(callback)jQuery(callback) $(document).ready()的简写。 允许你绑定一个在DOM文档载入完成后执行的函数。这个函数的作用如同$(document).ready()一样,只不过用这个函数时,需要把页面中所有需要在 DOM 加载完成时执行的$()操作符都包装到其中来。从技术上来说,这个函数是可链接的--但真正以这种方式链接的情况并不多。 你可以在一个页面中使用任意多个$(document).ready事件。 参考 ready(Function) 获取更多 ready 事件的信息。 -------------------------------------------------------------------------------- A shorthand for $(document).ready(). Allows you to bind a function to be executed when the DOM document has finished loading. This function behaves just like $(document).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready to be operated on. While this function is, technically, chainable - there really isn't much use for chaining against it. You can have as many $(document).ready events on your page as you like. See ready(Function) for details about the ready event. 返回值 jQuery 参数 callback (Function) : 当DOM加载完成后要执行的函数 示例 当DOM加载完成后,执行其中的函数。 jQuery 代码: $(function(){ // Document is ready }); -------------------------------------------------------------------------------- Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. jQuery 代码: jQuery(function($) { // Your code using failsafe $ alias here... }); jQuery 对象访问 each(callback)each(callback) 以每一个匹配的元素作为上下文来执行一个函数。 意味着,每次执行传递进来的函数时,函数中的this关键字都指向一个不同的DOM元素(每次都是一个不同的匹配元素)。 而且,在每次执行函数时,都会给函数传递一个表示作为执行环境的元素在匹配的元素集合中所处位置的数字值作为参数(从零开始的整形)。 返回 'false' 将停止循环 (就像在普通的循环中使用 'break')。返回 'true' 跳至下一个循环(就像在普通的循环中使用'continue')。 -------------------------------------------------------------------------------- Execute a function within the context of every matched element. This means that every time the passed-in function is executed (which is once for every element matched) the 'this' keyword points to the specific DOM element. Additionally, the function, when executed, is passed a single argument representing the position of the element in the matched set (integer, zero-index). Returning 'false' from within the each function completely stops the loop through all of the elements (this is like using a 'break' with a normal loop). Returning 'true' from within the loop skips to the next iteration (this is like using a 'continue' with a normal loop). 返回值 jQuery 参数 callback (Function) : 对于每个匹配的元素所要执行的函数 示例 迭代两个图像,并设置它们的 src 属性。注意:此处 this 指代的是 DOM 对象而非 jQuery 对象。 HTML 代码: jQuery 代码: $("img").each(function(i){ this.src = "test" + i + ".jpg"; }); 结果: [ , ] -------------------------------------------------------------------------------- 如果你想得到 jQuery对象,可以使用 $(this) 函数。 jQuery 代码: $("img").each(function(){ $(this).toggleClass("example"); }); -------------------------------------------------------------------------------- 你可以使用 'return' 来提前跳出 each() 循环。 HTML 代码:
Stop here
jQuery 代码: $("button").click(function () { $("div").each(function (index, domEle) { // domEle == this $(domEle).css("backgroundColor", "yellow"); if ($(this).is("#stop")) { $("span").text("Stopped at div index #" + index); return false; } }); });size()size() jQuery 对象中元素的个数。 这个函数的返回值与 jQuery 对象的'length' 属性一致。 -------------------------------------------------------------------------------- The number of elements in the jQuery object. This returns the same number as the 'length' property of the jQuery object. 返回值 Number 示例 计算文档中所有图片数量 HTML 代码: jQuery 代码: $("img").size(); 结果: 2 lengthlength jQuery 对象中元素的个数。 当前匹配的元素个数。 size 将返回相同的值。 -------------------------------------------------------------------------------- The number of elements in the jQuery object. The number of elements currently matched. The size function will return the same value. 返回值 Number 示例 计算文档中所有图片数量 HTML 代码: jQuery 代码: $("img").length; 结果: 2 get()get() 取得所有匹配的 DOM 元素集合。 这是取得所有匹配元素的一种向后兼容的方式(不同于jQuery对象,而实际上是元素数组)。 如果你想要直接操作 DOM 对象而不是 jQuery 对象,这个函数非常有用。 -------------------------------------------------------------------------------- Access all matched DOM elements. This serves as a backwards-compatible way of accessing all matched elements (other than the jQuery object itself, which is, in fact, an array of elements). It is useful if you need to operate on the DOM elements themselves instead of using built-in jQuery functions. 返回值 Array 示例 选择文档中所有图像作为元素数组,并用数组内建的 reverse 方法将数组反向。 HTML 代码: jQuery 代码: $("img").get().reverse(); 结果: [ ] get(index)get(index) 取得其中一个匹配的元素。 num表示取得第几个匹配的元素。 这能够让你选择一个实际的DOM 元素并且对他直接操作,而不是通过 jQuery 函数。$(this).get(0)与$(this)[0]等价。 -------------------------------------------------------------------------------- Access a single matched DOM element at a specified index in the matched set. This allows you to extract the actual DOM element and operate on it directly without necessarily using jQuery functionality on it. This function called as $(this).get(0) is the equivalent of using square bracket notation on the jQuery object itself like $(this)[0]. 返回值 Element 参数 index (Number) :取得第 index 个位置上的元素 示例 HTML 代码: jQuery 代码: $("img").get(0); 结果: [ ] index(subject)index(subject) 搜索与参数表示的对象匹配的元素,并返回相应元素的索引值值。 如果找到了匹配的元素,从0开始返回;如果没有找到匹配的元素,返回-1。 -------------------------------------------------------------------------------- Searches every matched element for the object and returns the index of the element, if found, starting with zero. Returns -1 if the object wasn't found. 返回值 Number 参数 subject (Element) : 要搜索的对象 示例 返回ID值为foobar的元素的索引值值。 HTML 代码:
jQuery 代码: $("*").index($('#foobar')[0]) 结果: 5 插件机制 jQuery.fn.extend(object)jQuery.fn.extend(object) 扩展 jQuery 元素集来提供新的方法(通常用来制作插件)。 查看这里Plugins/Authoring可以获取更多信息。 -------------------------------------------------------------------------------- Extends the jQuery element set to provide new methods (used to make a typical jQuery plugin). Can be used to add functions into the to add plugin methods (plugins). 返回值 jQuery 参数 object (Object) :用来扩充 jQuery 对象。 示例 增加两个插件方法。 jQuery 代码: jQuery.fn.extend({ check: function() { return this.each(function() { this.checked = true; }); }, uncheck: function() { return this.each(function() { this.checked = false; }); } }); 结果: $("input[@type=checkbox]").check(); $("input[@type=radio]").uncheck(); jQuery.extend(object)jQuery.extend(object) 扩展jQuery对象本身。 用来在jQuery命名空间上增加新函数。 查看 'jQuery.fn.extend' 获取更多添加插件的信息。 -------------------------------------------------------------------------------- Extends the jQuery object itself. Can be used to add functions into the jQuery namespace. See 'jQuery.fn.extend' for more information on using this method to add Plugins. 返回值 jQuery 参数 object (Object) : 用以扩展 jQuery 对象 示例 在jQuery命名空间上增加两个函数。 jQuery 代码: jQuery.extend({ min: function(a, b) { return a < b ? a : b; }, max: function(a, b) { return a > b ? a : b; } }); 结果: jQuery.min(2,3); // => 2 jQuery.max(4,5); // => 5 多库共存 jQuery.noConflict()jQuery.noConflict() 运行这个函数将变量$的控制权让渡给第一个实现它的那个库。 这有助于确保jQuery不会与其他库的$对象发生冲突。在运行这个函数后,就只能使用jQuery变量访问jQuery对象。例如,在要用到$("div p")的地方,就必须换成jQuery("div p")。 -------------------------------------------------------------------------------- Run this function to give control of the $ variable back to whichever library first implemented it. This helps to make sure that jQuery doesn't conflict with the $ object of other libraries. By using this function, you will only be able to access jQuery using the 'jQuery' variable. For example, where you used to do $("div p"), you now must do jQuery("div p"). 返回值 jQuery 示例 将$引用的对象映射回原始的对象。 jQuery 代码: jQuery.noConflict(); // 使用 jQuery jQuery("div p").hide(); // 使用其他库的 $() $("content").style.display = 'none'; -------------------------------------------------------------------------------- 恢复使用别名$,然后创建并执行一个函数,在这个函数的作用域中仍然将$作为jQuery的别名来使用。在这个函数中,原来的$对象是无效的。这个函数对于大多数不依赖于其他库的插件都十分有效。 jQuery 代码: jQuery.noConflict(); (function($) { $(function() { // 使用 $ 作为 jQuery 别名的代码 }); })(jQuery); // 其他用 $ 作为别名的库的代码 -------------------------------------------------------------------------------- 创建一个新的别名用以在接下来的库中使用jQuery对象。 jQuery 代码: var j = jQuery.noConflict(); // 基于 jQuery 的代码 j("div p").hide(); // 基于其他库的 $() 代码 $("content").style.display = 'none'; jQuery.noConflict(extreme)jQuery.noConflict(extreme) 将$和jQuery的控制权都交还给原来的库。用之前请考虑清楚! 这是相对于简单的 noConflict 方法更极端的版本,因为这将完全重新定义jQuery。这通常用于一种极端的情况,比如你想要将jQuery嵌入一个高度冲突的环境。注意:调用此方法后极有可能导致插件失效。 -------------------------------------------------------------------------------- Revert control of both the $ and jQuery variables to their original owners. Use with discretion. This is a more-extreme version of the simple noConflict method, as this one will completely undo what jQuery has introduced. This is to be used in an extreme case where you'd like to embed jQuery into a high-conflict environment. NOTE: It's very likely that plugins won't work after this particular method has been called. 返回值 jQuery 参数 extreme (Boolean) : 传入 true 来允许彻底将jQuery变量还原 示例 完全将 jQuery 移到一个新的命名空间。 jQuery 代码: var dom = {}; dom.query = jQuery.noConflict(true); 结果: // 新 jQuery 的代码 dom.query("div p").hide(); // 另一个库 $() 的代码 $("content").style.display = 'none'; // 另一个版本 jQuery 的代码 jQuery("div > p").hide(); 选择器基本 #id#id 根据给定的ID匹配一个元素。 -------------------------------------------------------------------------------- Matches a single element with the given id attribute. 返回值 Element 参数 id (String) : 用于搜索的,通过元素的 id 属性中给定的值 示例 查找 ID 为"myDiv"的元素。 HTML 代码:

id="notMe"

id="myDiv"
jQuery 代码: $("#myDiv"); 结果: [
id="myDiv"
] elementelement 根据给定的元素名匹配所有元素 -------------------------------------------------------------------------------- Matches all elements with the given name. 返回值 Array 参数 element (String) : 一个用于搜索的元素。指向 DOM 节点的标签名。 示例 查找一个 DIV 元素。 HTML 代码:
DIV1
DIV2
SPAN jQuery 代码: $("div"); 结果: [
DIV1
,
DIV2
] .class.class 根据给定的类匹配元素。 -------------------------------------------------------------------------------- Matches all elements with the given class. 返回值 Array 参数 class (String) : 一个用以搜索的类。一个元素可以有多个类,只要有一个符合就能被匹配到。 示例 查找所有类是 "myClass" 的元素. HTML 代码:
div class="notMe"
div class="myClass"
span class="myClass" jQuery 代码: $(".myClass"); 结果: [
div class="myClass"
, span class="myClass" ] ** 匹配所有元素 多用于结合上下文来搜索。 -------------------------------------------------------------------------------- Matches all elements. Most useful when combined with a context to search in. 返回值 Array 示例 找到每一个元素 HTML 代码:
DIV
SPAN

P

jQuery 代码: $("*") 结果: [
DIV
, SPAN,

P

] selector1,selector2,selectorNselector1,selector2,selectorN 将每一个选择器匹配到的元素合并后一起返回。 你可以指定任意多个选择器,并将匹配到的元素合并到一个结果内。 -------------------------------------------------------------------------------- Matches the combined results of all the specified selectors. You can specify any number of selectors to combine into a single result. 返回值 Array 参数 selector1 (Selector) : 一个有效的选择器 selector2 (Selector) : 另一个有效的选择器 selectorN (Selector) : (可选) 任意多个有效选择器 示例 找到匹配任意一个类的元素。 HTML 代码:
div

p class="myClass"

span

p class="notMyClass"

jQuery 代码: $("div,span,p.myClass") 结果: [
div
,

p class="myClass"

, span ] 层级 ancestor descendantancestor descendant 在给定的祖先元素下匹配所有的后代元素 -------------------------------------------------------------------------------- Matches all descendant elements specified by descendant of elements specified by ancestor. 返回值 Array 参数 ancestor (Selector) : 任何有效选择器 descendant (Selector) : 用以匹配元素的选择器,并且它是第一个选择器的后代元素 示例 找到表单中所有的 input 元素 HTML 代码:
jQuery 代码: $("form input") 结果: [ , ] parent > childparent > child 在给定的父元素下匹配所有的子元素 -------------------------------------------------------------------------------- Matches all child elements specified by child of elements specified by parent. 返回值 Array 参数 parent (Selector) : 任何有效选择器 child (Selector) : 用以匹配元素的选择器,并且它是第一个选择器的子元素 示例 匹配表单中所有的子级input元素。 HTML 代码:
jQuery 代码: $("form > input") 结果: [ ] prev + nextprev + next 匹配所有紧接在 prev 元素后的 next 元素 -------------------------------------------------------------------------------- Matches all next elements specified by next that are next to elements specified by prev. 返回值 Array 参数 prev (Selector) : 任何有效选择器 next (Selector) :一个有效选择器并且紧接着第一个选择器 示例 匹配所有跟在 label 后面的 input 元素 HTML 代码:
jQuery 代码: $("label + input") 结果: [ , ] prev ~ siblingsprev ~ siblings 匹配 prev 元素之后的所有 siblings 元素 -------------------------------------------------------------------------------- Matches all sibling elements after the "prev" element that match the filtering "siblings" selector. 返回值 Array 参数 prev (Selector) : 任何有效选择器 siblings (Selector) : 一个选择器,并且它作为第一个选择器的同辈 示例 找到所有与表单同辈的 input 元素 HTML 代码:
jQuery 代码: $("form ~ input") 结果: [ ] 简单 :first:first 匹配找到的第一个元素 -------------------------------------------------------------------------------- Matches the first selected element. 返回值 Element 示例 查找表格的第一行 HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:first") 结果: [ Header 1 ] :last:last 匹配找到的最后一个元素 -------------------------------------------------------------------------------- Matches the last selected element. 返回值 Element 示例 查找表格的最后一行 HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:last") 结果: [ Value 2 ] :not(selector):not(selector) 去除所有与给定选择器匹配的元素 -------------------------------------------------------------------------------- Removes all elements matching the given selector. 返回值 Array 参数 selector (Selector) : 用于筛选的选择器 示例 查找所有未选中的 input 元素 HTML 代码: jQuery 代码: $("input:not(:checked)") 结果: [ ] :even:even 匹配所有索引值为偶数的元素,从 0 开始计数 -------------------------------------------------------------------------------- Matches even elements, zero-indexed. 返回值 Array 示例 查找表格的1、3、5...行(即索引值0、2、4...) HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:even") 结果: [ Header 1, Value 2 ] :odd:odd 匹配所有索引值为奇数的元素,从 0 开始计数 -------------------------------------------------------------------------------- Matches odd elements, zero-indexed. 返回值 Array 示例 查找表格的2、4、6行(即索引值1、3、5...) HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:odd") 结果: [ Value 1 ] :eq(index):eq(index) 匹配一个给定索引值的元素 -------------------------------------------------------------------------------- Matches a single element by its index. 返回值 Element 参数 index (Number) : 从 0 开始计数 示例 查找第二行 HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:eq(1)") 结果: [ Value 1 ] :gt(index):gt(index) 匹配所有大于给定索引值的元素 -------------------------------------------------------------------------------- Matches all elements with an index above the given one. 返回值 Array 参数 index (Number) : 从 0 开始计数 示例 查找第二第三行,即索引值是1和2,也就是比0大 HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:gt(0)") 结果: [ Value 1, Value 2 ] :lt(index):lt(index) 匹配所有小于给定索引值的元素 -------------------------------------------------------------------------------- Matches all elements with an index below the given one. 返回值 Array 参数 index (Number) : 从 0 开始计数 示例 查找第一第二行,即索引值是0和1,也就是比2小 HTML 代码:
Header 1
Value 1
Value 2
jQuery 代码: $("tr:lt(2)") 结果: [ Header 1, Value 1 ] :header:header 匹配如 h1, h2, h3之类的标题元素 -------------------------------------------------------------------------------- Matches all elements that are headers, like h1, h2, h3 and so on. 返回值 Array 示例 给页面内所有标题加上背景色 HTML 代码:

Header 1

Contents 1

Header 2

Contents 2

jQuery 代码: $(":header").css("background", "#EEE"); 结果: [

Header 1

,

Header 2

] :animated:animated 匹配所有没有在执行动画效果中的元素 -------------------------------------------------------------------------------- Matches all elements that are currently being animated. 返回值 Array 示例 只有对不在执行动画效果的元素执行一个动画特效 HTML 代码:
jQuery 代码: $("#run").click(function(){ $("div:not(:animated)").animate({ left: "+20" }, 1000); }); 内容 :contains(text):contains(text) 匹配包含给定文本的元素 -------------------------------------------------------------------------------- Matches elements which contain the given text. 返回值 Array 参数 text (String) : 一个用以查找的字符串 示例 查找所有包含 "John" 的 div 元素 HTML 代码:
John Resig
George Martin
Malcom John Sinclair
J. Ohn jQuery 代码: $("div:contains('John')") 结果: [
John Resig
,
Malcom John Sinclair
] :empty:empty 匹配所有不包含子元素或者文本的空元素 -------------------------------------------------------------------------------- Matches all elements that are empty, be it elements or text. 返回值 Array 示例 查找所有不包含子元素或者文本的空元素 HTML 代码:
Value 1
Value 2
jQuery 代码: $("td:empty") 结果: [ , ] :has(selector):has(selector) 匹配含有选择器所匹配的元素的元素 -------------------------------------------------------------------------------- Matches elements which contain at least one element that matches the specified selector. 返回值 Array 参数 selector (Selector) : 一个用于筛选的选择器 示例 给所有包含 p 元素的 div 元素添加一个 text 类 HTML 代码:

Hello

Hello again!
jQuery 代码: $("div:has(p)").addClass("test"); 结果: [

Hello

] :parent:parent 匹配含有子元素或者文本的元素 -------------------------------------------------------------------------------- Matches all elements that are parents - they have child elements, including text. 返回值 Array 示例 查找所有含有子元素或者文本的 td 元素 HTML 代码:
Value 1
Value 2
jQuery 代码: $("td:parent") 结果: [ Value 1, Value 1 ] 可见性 :hidden:hidden 匹配所有的不可见元素,input 元素的 type 属性为 "hidden" 的话也会被匹配到 -------------------------------------------------------------------------------- Matches all elements that are hidden, or input elements of type "hidden". 返回值 Array 示例 查找所有不可见的 tr 元素 HTML 代码:
Value 1
Value 2
jQuery 代码: $("tr:hidden") 结果: [ Value 1 ] :visible:visible 匹配所有的可见元素 -------------------------------------------------------------------------------- Matches all elements that are visible. 返回值 Array 示例 查找所有可见的 tr 元素 HTML 代码:
Value 1
Value 2
jQuery 代码: $("tr:visible") 结果: [ Value 2 ] 属性 [attribute][attribute] 匹配包含给定属性的元素 -------------------------------------------------------------------------------- Matches elements that have the specified attribute. 返回值 Array 参数 attribute (String) : 属性名 示例 查找所有含有 id 属性的 div 元素 HTML 代码:

Hello!

jQuery 代码: $("div[id]") 结果: [
] [attribute=value][attribute=value] 匹配给定的属性是某个特定值的元素 -------------------------------------------------------------------------------- Matches elements that have the specified attribute with a certain value. 返回值 Array 参数 attribute (String) : 属性名 value (String) : 属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时,用以避免冲突。 示例 查找所有 name 属性是 newsletter 的 input 元素 HTML 代码: ' jQuery 代码: $("input[name='newsletter']").attr("checked", true); 结果: [ , ] [attribute!=value][attribute!=value] 匹配给定的属性是不包含某个特定值的元素 -------------------------------------------------------------------------------- Matches elements that don't have the specified attribute with a certain value. 返回值 Array 参数 attribute (String) : 属性名 value (String) : 属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时,用以避免冲突。 示例 查找所有 name 属性不是 newsletter 的 input 元素 HTML 代码: ' jQuery 代码: $("input[name!='newsletter']").attr("checked", true); 结果: [ ] [attribute^=value][attribute^=value] 匹配给定的属性是以某些值开始的元素 -------------------------------------------------------------------------------- Matches elements that have the specified attribute and it starts with a certain value. 返回值 Array 参数 attribute (String) : 属性名 value ( String) : 属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时,用以避免冲突。 示例 查找所有 name 以 'news' 开始的 input 元素 HTML 代码: jQuery 代码: $("input[name^='news']") 结果: [ , ] [attribute$=value][attribute$=value] 匹配给定的属性是以某些值结尾的元素 -------------------------------------------------------------------------------- Matches elements that have the specified attribute and it ends with a certain value. 返回值 Array 参数 attribute (String) : 属性名 value (String) : 属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时,用以避免冲突。 示例 查找所有 name 以 'letter' 结尾的 input 元素 HTML 代码: jQuery 代码: $("input[name$='letter']") 结果: [ , ] [attribute*=value][attribute*=value] 匹配给定的属性是以包含某些值的元素 -------------------------------------------------------------------------------- Matches elements that have the specified attribute and it contains a certain value. 返回值 Array 参数 attribute (String) : 属性名 value (String) : 属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时,用以避免冲突。 示例 查找所有 name 包含 'man' 的 input 元素 HTML 代码: jQuery 代码: $("input[name*='man']") 结果: [ , , ] [selector1][selector2][selectorN][selector1][selector2][selectorN] 复合属性选择器,需要同时满足多个条件时使用。 -------------------------------------------------------------------------------- Matches elements that have the specified attribute and it contains a certain value. 返回值 Array 参数 selector1 (Selector) : 属性选择器 selector2 (Selector) : 另一个属性选择器,用以进一步缩小范围 selectorN (Selector) : 任意多个属性选择器 示例 找到所有含有 id 属性,并且它的 name 属性是以 man 结尾的 HTML 代码: jQuery 代码: $("input[id][name$='man']") 结果: [ ] 子元素 :nth-child(index/even/odd/equation):nth-child(index/even/odd/equation) 匹配其父元素下的第N个子或奇偶元素 ':eq(index)' 只匹配一个元素,而这个将为每一个父元素匹配子元素。:nth-child从1开始的,而:eq()是从0算起的! 可以使用: nth-child(even) :nth-child(odd) :nth-child(3n) :nth-child(2) :nth-child(3n+1) :nth-child(3n+2) -------------------------------------------------------------------------------- Matches the nth-child of its parent. While ':eq(index)' matches only a single element, this matches more then one: One for each parent. The specified index is one-indexed, in contrast to :eq() which starst at zero. 返回值 Array 参数 index (Number) : 要匹配元素的序号,从1开始 示例 在每个 ul 查找第 2 个li HTML 代码:
  • John
  • Karl
  • Brandon
  • Glen
  • Tane
  • Ralph
jQuery 代码: $("ul li:nth-child(2)") 结果: [
  • Karl
  • ,
  • Tane
  • ] :first-child:first-child 匹配第一个子元素 ':first' 只匹配一个元素,而此选择符将为每个父元素匹配一个子元素 -------------------------------------------------------------------------------- Matches the first child of its parent. While ':first' matches only a single element, this matches more then one: One for each parent. 返回值 Array 示例 在每个 ul 中查找第一个 li HTML 代码:
    • John
    • Karl
    • Brandon
    • Glen
    • Tane
    • Ralph
    jQuery 代码: $("ul li:first-child") 结果: [
  • John
  • ,
  • Glen
  • ] :last-child:last-child 匹配最后一个子元素 ':last'只匹配一个元素,而此选择符将为每个父元素匹配一个子元素 -------------------------------------------------------------------------------- Matches the last child of its parent. While ':last' matches only a single element, this matches more then one: One for each parent. 返回值 Array 示例 在每个 ul 中查找最后一个 li HTML 代码:
    • John
    • Karl
    • Brandon
    • Glen
    • Tane
    • Ralph
    jQuery 代码: $("ul li:last-child") 结果: [
  • Brandon
  • ,
  • Ralph
  • ] :only-child:only-child 如果某个元素是父元素中唯一的子元素,那将会被匹配 如果父元素中含有其他元素,那将不会被匹配。 -------------------------------------------------------------------------------- Matches the only child of its parent. If the parent has other child elements, nothing is matched. 返回值 Array 示例 在 ul 中查找是唯一子元素的 li HTML 代码:
    • John
    • Karl
    • Brandon

    1,265

    社区成员

    发帖
    与我相关
    我的任务
    社区描述
    软件工程/管理 管理版
    社区管理员
    • 研发管理社区
    加入社区
    • 近7日
    • 近30日
    • 至今
    社区公告
    暂无公告

    试试用AI创作助手写篇文章吧