??xml version="1.0" encoding="utf-8" standalone="yes"?> AJAX 行之后QL好好学习(fn)一下。但是众多的框架实在难以选择。说明一?ASP.NET AJAX q不包括?AJAX 框架之中?br />
刚开始学?JQuqeryQ?众多?nbsp;$get(),...{等W号早已把我搞晕了。暂时就攑ּ了?br />
后来学习(fn) ASP.NET AJAX Q在微Y的领gQ逐渐由服务器端{向客L(fng)~程?Ȁh客户端编E的兴趣Q?br />
才想起学?fn)一下了 Jquery.
随着WEB2.0?qing)ajax思想在互联网上的快速发展传播,陆箋出现了一些优U的Js框架Q其中比较著名的有Prototype、YUI、jQuery、mootools、Bindows以及(qing)国内的JSVM框架{,通过这些JS框架应用到我们的目中能够ɽE序员从设计和书写繁杂的JS应用中解脱出来,关注点转向功能需求而非实现l节上,从而提高项目的开发速度?a name="entrymore">
jQuery是prototype之后的又一个优U的Javascript框架。它是由 John Resig ?2006 q初创徏的,它有助于?JavaScript™ 以及(qing)Ajax ~程。有Z用这L(fng)一比喻来比较prototype和jQueryQprototype像JavaQ而jQuery像ruby. 它是一个简z快速灵zȝJavaScript框架Q它能让你在你的|页上简单的操作文档、处理事件、实现特效ƈ为Web面dAjax交互?br />
它具有如下一些特点:(x)
1、代码简l、语义易懂、学?fn)快速、文档丰富?br />
2、jQuery是一个轻量的脚本,其代码非常小巧,最新版的JavaScript包只?0K左右?br />
3、jQuery支持CSS1-CSS3,以及(qing)基本的xPath?br />
4、jQuery是跨览器的Q它支持的浏览器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+?br />
5、可以很Ҏ(gu)的ؓ(f)jQuery扩展其他功能?br />
6、能JS代码和HTML代码完全分离Q便于代码和l护和修攏V?br />
7、插件丰富,除了jQuery本n带有的一些特效外Q可以通过插g实现更多功能Q如表单验证、tabD、拖放效果、表格排序、DataGridQ树(wi)形菜单、图像特效以?qing)ajax上传{?br />
jQuery的设计会(x)改变你写JavaScript代码的方式,降低你学?fn)用JS操作|页的复杂度Q提高网JS开发效率,无论对于js初学者还是资׃ӞjQuery都将是?zhn)的首选?br />
jQuery适合于设计师、开发者以?qing)那些还好者,同样适合用于商业开发,可以说jQuery适合MJavaScript应用的地方,可用于不同的Web应用E序中?br />
官方站点Q?a target="_blank">http://jquery.com/ 中文站点Q?a target="_blank">http://jquery.org.cn/
1.2、目?/strong>
通过学习(fn)本文档,能够对jQuery有一个简单的认识了解Q清楚JQuery与其他JS框架的不同,掌握jQuery的常用语法、用技巧及(qing)注意事项?br />
二、用方?/strong>
在需要用JQuery的页面中引入JQuery的js文g卛_?br />
例如Q?lt;script type="text/javascript" src="js/jquery.js"></script>
引入之后便可在页面的L地方使用jQuery提供的语法?br />
三、学?fn)教E及(qing)参考资?/strong>
请参照《jQuery中文API手册》和http://jquery.org.cn/visual/cn/index.xml
推荐两篇不错的jquery教程Q《jQuery的vҎ(gu)E》和《?jQuery ?Ajax 开发?br />
四、语法ȝ和注意事?/strong>
1、关于页面元素的引用
通过jquery?()引用元素包括通过id、class、元素名以及(qing)元素的层U关pd(qing)dom或者xpath条g{方法,且返回的对象为jquery对象Q集合对象)Q不能直接调用dom定义的方法?br />
2、jQuery对象与dom对象的{?/span>
只有jquery对象才能使用jquery定义的方法。注意dom对象和jquery对象是有区别的,调用Ҏ(gu)时要注意操作的是dom对象q是jquery对象?br />
普通的dom对象一般可以通过$()转换成jquery对象?br />
如:(x)$(document.getElementById("msg"))则ؓ(f)jquery对象Q可以用jquery的方法?br />
׃jquery对象本n是一个集合。所以如果jquery对象要{换ؓ(f)dom对象则必d出其中的某一,一般可通过索引取出?br />
如:(x)$("#msg")[0]Q?("div").eq(1)[0]Q?("div").get()[1]Q?("td")[5]q些都是dom对象Q可以用dom中的Ҏ(gu)Q但不能再用Jquery的方法?br />
以下几种写法都是正确的:(x)
$("#msg").html();
$("#msg")[0].innerHTML;
$("#msg").eq(0)[0].innerHTML;
$("#msg").get(0).innerHTML;
3、如何获取jQuery集合的某一?/span>
对于获取的元素集合,获取其中的某一(通过索引指定Q可以?span style="color: blue">eq?span style="color: blue">get(n)Ҏ(gu)或者烦引号获取Q?span style="color: orange">要注意,eqq回的是jquery对象Q而get(n)和烦引返回的是dom元素对象。对于jquery对象只能使用jquery的方法,而dom对象只能使用dom的方法,如要获取W三?lt;div>元素的内宏V有如下两种Ҏ(gu)Q?br />
$("div").eq(2).html(); //调用jquery对象的方?br />
$("div").get(2).innerHTML; //调用dom的方法属?br />
4、同一函数实现set和get
Jquery中的很多Ҏ(gu)都是如此Q主要包括如下几个:(x)
$("#msg").html(); //q回id为msg的元素节点的html内容?br />
$("#msg").html("<b>new content</b>");
//?#8220;<b>new content</b>” 作ؓ(f)html串写入id为msg的元素节点内容中,面昄_体的new content
$("#msg").text(); //q回id为msg的元素节点的文本内容?br />
$("#msg").text("<b>new content</b>");
//?#8220;<b>new content</b>” 作ؓ(f)普通文本串写入id为msg的元素节点内容中,面昄<b>new content</b>
$("#msg").height(); //q回id为msg的元素的高度
$("#msg").height("300"); //id为msg的元素的高度设ؓ(f)300
$("#msg").width(); //q回id为msg的元素的宽度
$("#msg").width("300"); //id为msg的元素的宽度设ؓ(f)300
$("input").val("); //q回表单输入框的value?br />
$("input").val("test"); //表单输入框的valueD为test
$("#msg").click(); //触发id为msg的元素的单击事g
$("#msg").click(fn); //为id为msg的元素单M件添加函?br />
同样blur,focus,select,submit事g都可以有着两种调用Ҏ(gu)
5、集合处理功?/span>
对于jqueryq回的集合内Ҏ(gu)需我们自己循环遍历q对每个对象分别做处理,jquery已经为我们提供的很方便的Ҏ(gu)q行集合的处理?br />
包括两种形式Q?br />
$("p").each(function(i){this.style.color=['#f00','#0f0','#00f'][i]})
//为烦引分别ؓ(f)0Q?Q?的p元素分别讑֮不同的字体颜艌Ӏ?br />
$("tr").each(function(i){this.style.backgroundColor=['#ccc','#fff'][i%2]})
//实现表格的隔行换色效?br />
$("p").click(function(){alert($(this).html())})
//为每个p元素增加了click事gQ单?yn)L个p元素则弹出其内容
6、扩展我们需要的功能
$.extend({
min: function(a, b){return a < b?a:b; },
max: function(a, b){return a > b?a:b; }
}); //为jquery扩展了min,max两个Ҏ(gu)
使用扩展的方法(通过“$.Ҏ(gu)?#8221;调用Q:(x)
alert("a=10,b=20,max="+$.max(10,20)+",min="+$.min(10,20));
7、支持方法的q写
所谓连写,卛_以对一个jquery对象q箋调用各种不同的方法?br />
例如Q?br />
$("p").click(function(){alert($(this).html())})
.mouseover(function(){alert('mouse over event')})
.each(function(i){this.style.color=['#f00','#0f0','#00f'][i]});
8、操作元素的样式
主要包括以下几种方式Q?br />
$("#msg").css("background"); //q回元素的背景颜?br />
$("#msg").css("background","#ccc") //讑֮元素背景为灰?br />
$("#msg").height(300); $("#msg").width("200"); //讑֮宽高
$("#msg").css({ color: "red", background: "blue" });//以名值对的Ş式设定样?br />
$("#msg").addClass("select"); //为元素增加名UCؓ(f)select的class
$("#msg").removeClass("select"); //删除元素名称为select的class
$("#msg").toggleClass("select"); //如果存在Q不存在Q就删除Q添加)名称为select的class
9、完善的事g处理功能
Jquery已经为我们提供了各种事g处理Ҏ(gu)Q我们无需在html元素上直接写事gQ而可以直接ؓ(f)通过jquery获取的对象添加事件?br />
如:(x)
$("#msg").click(function(){alert("good")}) //为元素添加了单击事g
$("p").click(function(i){this.style.color=['#f00','#0f0','#00f'][i]})
//Z个不同的p元素单击事g分别讑֮不同的处?br />
jQuery中几个自定义的事Ӟ(x)
Q?Q?span style="color: blue">hover(fn1,fn2)Q?/span>一个模仿?zhn)停事Ӟ鼠标UdC个对象上面及(qing)Udq个对象Q的Ҏ(gu)。当鼠标UdC个匹配的元素上面Ӟ?x)触发指定的W一个函数。当鼠标Udq个元素Ӟ?x)触发指定的W二个函数?br />
//当鼠标放在表格的某行上时class|ؓ(f)overQ离开时置为out?br />
$("tr").hover(function(){
$(this).addClass("over");
},
function(){
$(this).addClass("out");
});
Q?Q?span style="color: blue">ready(fn):当DOM载入qA可以查询?qing)操U|l定一个要执行的函数?br />
$(document).ready(function(){alert("Load Success")})
//面加蝲完毕提示“Load Success”,相当于onload事g。与$(fn){h(hun)
Q?Q?span style="color: blue">toggle(evenFn,oddFn): 每次点击时切换要调用的函数。如果点M一个匹配的元素Q则触发指定的第一个函敎ͼ当再ơ点d一元素Ӟ则触发指定的W二个函数。随后的每次点击都重复对q两个函数的轮番调用?br />
//每次点击时轮换添加和删除名ؓ(f)selected的class?br />
$("p").toggle(function(){
$(this).addClass("selected");
},function(){
$(this).removeClass("selected");
});
Q?Q?span style="color: blue">trigger(eventtype): 在每一个匹配的元素上触发某cM件?br />
例如Q?br />
$("p").trigger("click"); //触发所有p元素的click事g
Q?Q?span style="color: blue">bind(eventtype,fn)Qunbind(eventtype): 事g的绑定与反绑?br />
从每一个匹配的元素中(dQ删除绑定的事g?br />
例如Q?br />
$("p").bind("click", function(){alert($(this).text());}); //为每个p元素d单击事g
$("p").unbind(); //删除所有p元素上的所有事?br />
$("p").unbind("click") //删除所有p元素上的单击事g
10、几个实用特效功?/span>
其中toggle()和slidetoggle()Ҏ(gu)提供了状态切换功能?br />
如toggle()Ҏ(gu)包括了hide()和show()Ҏ(gu)?br />
slideToggle()Ҏ(gu)包括了slideDown()和slideUpҎ(gu)?br />
11、几个有用的jQueryҎ(gu)
$.browser.览器类型:(x)浏览器cd。有效参敎ͼ(x)safari, opera, msie, mozilla。如是否ieQ?.browser.isieQ是ie览器则q回true?br />
$.each(obj, fn)Q?/span>通用的P代函数。可用于q似地P代对象和数组Q代替@环)?br />
?br />
$.each( [0,1,2], function(i, n){ alert( "Item #" + i + ": " + n ); });
{h(hun)于:(x)
var tempArr=[0,1,2];
for(var i=0;i<tempArr.length;i++){
alert("Item #"+i+": "+tempArr[i]);
}
也可以处理json数据Q如
$.each( { name: "John", lang: "JS" }, function(i, n){ alert( "Name: " + i + ", Value: " + n ); });
l果为:(x)
Name:name, Value:John
Name:lang, Value:JS
$.extend(target,prop1,propN)Q?/span>用一个或多个其他对象来扩展一个对象,q回q个被扩展的对象。这是jquery实现的承方式?br />
如:(x)
$.extend(settings, options);
//合ƈsettings和optionsQƈ合q结果返回settings中,相当于optionsl承settingq将l承l果保存在setting中?br />
var settings = $.extend({}, defaults, options);
//合ƈdefaults和optionsQƈ合q结果返回到setting中而不覆盖default内容?br />
可以有多个参敎ͼ合ƈ多项q返回)
$.map(array, fn)Q?/span>数组映射。把一个数l中的项?处理转换?保存到到另一个新数组中,q返回生成的新数l?br />
如:(x)
var tempArr=$.map( [0,1,2], function(i){ return i + 4; });
tempArr内容为:(x)[4,5,6]
var tempArr=$.map( [0,1,2], function(i){ return i > 0 ? i + 1 : null; });
tempArr内容为:(x)[2,3]
$.merge(arr1,arr2):合ƈ两个数组q删除其中重复的目?br />
如:(x)$.merge( [0,1,2], [2,3,4] ) //q回[0,1,2,3,4]
$.trim(str)Q?/span>删除字符串两端的I白字符?
如:(x)$.trim(" hello, how are you? "); //q回"hello,how are you? "
12、解册定义Ҏ(gu)或其他类库与jQuery的冲H?/span>
很多时候我们自己定义了$(id)Ҏ(gu)来获取一个元素,或者其他的一些jscd如prototype也都定义?Ҏ(gu)Q如果同时把q些内容攑֜一起就?x)引起变量方法定义冲H,JqueryҎ(gu)专门提供了方法用于解x问题?br />
使用jquery中的jQuery.noConflict();Ҏ(gu)卛_把变?的控制权让渡l第一个实现它的那个库或之前自定义?Ҏ(gu)。之后应用Jquery的时候只要将所有的$换成jQuery卛_Q如原来引用对象Ҏ(gu)$("#msg")改ؓ(f)jQuery("#msg")?br />
如:(x)
jQuery.noConflict();
// 开始用jQuery
jQuery("div p").hide();
// 使用其他库的 $()
$("content").style.display = 'none';
]]>
]]>
1307-1581-4356-2616-4951-7949 (Commercial Version)
1307-1581-4356-2939-1231-4484 (Education Version)
Charting License:
1301-4581-4356-7349-9369-3351 (Commercial Version)
Today we shipped Visual Studio 2008 and .NET 3.5. You can download the final release using one of the links below:
If you are a MSDN subscriber, you can download your copy from the MSDN subscription site (note: some of the builds are just finishing being uploaded now - so check back later during the day if you don't see it yet).
If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here. A 90-day trial edition of Visual Studio 2008 Professional (which will be a slightly smaller download) will be available next week. A 90-day free trial edition of Team Foundation Server can also be downloaded here.
If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here.
If you want to just install the .NET Framework 3.5 runtime, you can download it here.
Visual Studio 2008 and .NET 3.5 contain a ton of new functionality and improvements. Below are links to blog posts I've done myself as well as links to videos you can watch to learn more about it:
VS 2008 Multi-Targeting Support
VS 2008 enables you to build applications that target multiple versions of the .NET Framework. This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines. You can learn more about how this works from my blog post here:
ASP.NET AJAX and JavaScript Support
.NET 3.5 has ASP.NET AJAX built-in (no separate download required). In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like <asp:menu> and <asp:treeview>, WCF support for JSON, and many other AJAX improvements.
VS 2008 and Visual Web Developer 2008 also now have great support for integrating JavaScript and AJAX into your applications. You can learn more about this from my blog posts here:
You can watch some videos that discuss ASP.NET AJAX and Visual Studio 2008 support for it here.
I also highly recommend the excellent ASP.NET AJAX in Action book to learn more about ASP.NET AJAX (both client-side and server-side).
VS 2008 Web Designer and CSS Support
VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web). This delivers support for split-view editing, nested master pages, and great CSS integration. Below are some articles I've written that discuss this more:
ASP.NET 3.5 also has a new <asp:ListView> control that provides the ability to perform rich data scenarios with total control over the markup. It works nicely with the new CSS support in VS 2008. You can learn more about it from my article here:
You can watch some videos that discuss the new Visual Studio 2008 web designer features and the new ListView/DataPager controls here.
Language Improvements and LINQ
The new VB and C# compilers in VS 2008 deliver significant improvements to the languages. Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code. These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET.
Below are some of the articles I've written that explore these new language features using C#:
Here are a few additional blog posts I've written that show off some of the new VS 2008 code editing support and some cool ways to use these new language features:
The Visual Basic team has also created some great free videos that cover LINQ. You can watch them here.
Data Access Improvements with LINQ to SQL
LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5. It enables you to model relational databases using a .NET object model. You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL fully supports transactions, views, and stored procedures. It also provides an easy way to integrate business logic and validation rules into your data model. Below are some of the articles I've written that explore how to use it:
I think you'll find that LINQ and LINQ to SQL makes it much easier to build much cleaner data models, and write much cleaner data code. I'll be adding more posts to my LINQ to SQL series in the weeks and months ahead (sorry for the delay in finishing them earlier - so much to-do and so little time to-do it all!).
Scott Stanfield is also working on creating some great LINQ to SQL videos for the www.asp.net site based on my article series above (all videos are in both VB and C#). You can watch the first 4 videos in this series here.
Browsing the .NET Framework Library Source using Visual Studio
As I blogged a few weeks ago, we will be releasing a reference version of the .NET Framework library source code as part of this release. Visual Studio 2008 has built-in debugger support to automatically step-into and debug this code on demand (VS 2008 can pull down the source for the appropriate .NET Framework library file automatically for you).
We are deploying the source servers to enable this right now, and will be publishing the steps to turn this feature on in the next few weeks.
Lots of other improvements
The list above is only a small set of the improvements coming. For client development VS 2008 includes WPF designer and project support. ClickOnce and WPF XBAPs now work with FireFox. WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data.
Office development is much richer - including support for integrating with the Office 2007 ribbon, and with Outlook. Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).
New WCF and Workflow projects and designers are now included in VS 2008. Unit testing support is now much faster and included in VS Professional (and no longer just VSTS). Continuous Integration support is now built-in with TFS. AJAX web testing (unit and load) is now supported in the VS Test SKU. And there is much, much more...
People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008. In general I'd recommend uninstalling the Beta2 bits explicitly. As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately). I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install. You can then install the final release of VS 2008 and .NET 3.5 on the machine.
Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the "Reset Settings" option, and then re-pick your preferred profile. This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).
Note that VS 2008 runs side-by-side with VS 2005 - so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).
Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release. These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio. Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks. If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available.
在开?gt;讄>控制面版>d或删除程?gt;卸蝲vs.net2008Q出现卸载界面>点击NextQ输入上面CD-key ->出现Success画面。。激动ING
本h使用的是VS2008 RTM?.
Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO
ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO.iso [3.83 Gb]
ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Suite-ZWTiSO.nfo [5.8 Kb]
[ Add all 2 links to your ed2k client ]
Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO
ed2k: Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO.iso [3.31 Gb]
ed2k: Microsoft.Visual.Studio.2008.Professional.Edition-ZWTiSO.nfo [5.5 Kb]
[ Add all 2 links to your ed2k client ]
Microsoft.Visual.Studio.Team.System.2008.Development.Edition
ed2k: Microsoft.Visual.Studio.Team.System.2008.Development.Edition-ZWTiSO.iso [3.81 Gb]
ed2k: Microsoft.Visual.Studio.Team.System.2008.Development.Edition-ZWTiSO.nfo [5.5 Kb]
[ Add all 2 links to your ed2k client ]
Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO
ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO.iso [1.29 Gb]
ed2k: Microsoft.Visual.Studio.Team.System.2008.Team.Foundation.Server.Workgroup.Edition-ZWTiSO.nfo [5.7 Kb]
[ Add all 2 links to your ed2k client ]
Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWT
ed2k: Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWTiSO.iso [551.01 Mb]
ed2k: Microsoft.Visual.Studio.Team.System.2008.Test.Load.Agent-ZWTiSO.nfo [5.7 Kb]
[ Add all 2 links to your ed2k client ]
有个pȝ隐藏的文件夹System Volume Information?x)达?G甚至20GQ这是系l还原的文g夹,q个目录是WINDOWS对于大硬盘搜索方便的索引记录文gQ会(x)在WINDOWSI闲时自动记录,所以这个文件夹?x)越来越大,然后PF使用率不断上升,D机器卡住Q?font style="FONT-SIZE: 0px; COLOR: #f7f7ff">&W&D.C g V b j [ a
我们可以用q个自动索引功能Q打开搜烦功能->改变首选项->不用制作烦引服?>不,不要启用制作索引服务->定。还有一件事Q就是回到刚才的地方Q下面还有一?#8220;改变制作索引服务讄Q高U)”Q按下去Q右键弹出的H口中的那个索引服务->删除Q就好了Q?font style="FONT-SIZE: 0px; COLOR: #f7f7ff">数据中心服务器论?Y \ M z(R1{
O f ?&f t j9Y&] B ` SystemVolumeInformation\catalog.wci的文件用来存攄引文Ӟ而且在系l空闲时QW(xu)indows?x)自动读盘更新索引Q安装的文g多Q烦引文件会(x)来大?br> D Y }&X
删除索引服务Q?font style="FONT-SIZE: 0px; COLOR: #f7f7ff">数据、服务器论坛联盟、win服务器、代理服务器,邮g服务器、代码、程序、游戏下载、Y件、电(sh)脑技术、设计、图片、信息发?N i$y l z:M }
q行msconfigQ然后选择服务选项Q找到IndexingServiceQ将前面的小勑֎掉,再删掉文件夹卛_?/div> |