<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotnetslackers.com/Community/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programmatically Speaking ...</title><link>http://dotnetslackers.com/Community/blogs/xun/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 SP1 (Build: 30415.43)</generator><item><title>Task reminder - Last Day of October</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/11/01/task-reminder-last-day-of-october.aspx</link><pubDate>Fri, 31 Oct 2008 20:18:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29738</guid><dc:creator>xxxd</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29738</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/11/01/task-reminder-last-day-of-october.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/octoberreminder.jpg"&gt;&lt;img border="0" src="http://dotnetslackers.com/Community/blogs/xun/octoberreminder.jpg" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29738" width="1" height="1"&gt;</description></item><item><title>Visual Studio 2010 and ASP .NET 4.0</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/27/visual-studio-2010-and-asp-net-4-0.aspx</link><pubDate>Mon, 27 Oct 2008 16:16:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29658</guid><dc:creator>xxxd</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29658</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/27/visual-studio-2010-and-asp-net-4-0.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;When you are a new kid, you cannot wait to grow up. However, when you are older then older, every passing year makes you feel the loss and the tick of the clock. &lt;/p&gt;
&lt;p&gt;That is how I also feel about the forward-and-fast moving versions of software and programming models, frameworks and technologies.&lt;/p&gt;
&lt;p&gt;Here it comes: Visual Studio 2010. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2848"&gt;http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2848&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here it comes again: asp .net 4.0. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14924"&gt;http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14924&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29658" width="1" height="1"&gt;</description></item><item><title>Other people's work</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/24/other-people-s-work.aspx</link><pubDate>Fri, 24 Oct 2008 18:50:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29635</guid><dc:creator>xxxd</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29635</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/24/other-people-s-work.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;Shame to say, there are so many cool functionalities I have never&amp;nbsp;coded nor used in my websites, such as programmatically generate screenshots, generate animated gif using a sequence of screenshot, create captcha, in-progress animated image. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Fortunately, there are many pieces of working code up for&amp;nbsp;taking on the web.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;ASP .NET&amp;nbsp;Captcha server control :&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx"&gt;http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Very popular (meaning it has been widely tested)&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Screenshot of Webpage with ASP.NET&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.codegod.de/WebAppCodeGod/Screenshot-of-Webpage-with-ASP-NET-AID398.aspx"&gt;http://www.codegod.de/WebAppCodeGod/Screenshot-of-Webpage-with-ASP-NET-AID398.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Make use of &lt;em&gt;IECapt.exe&lt;/em&gt; to capture screenshot of a web page given by an URL&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Create an animated GIF using .Net (C#)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;This seems to be a hard one. Most animated GIFs are created by using offline imaging software, however, I sometimes I really want to streamline this process, especially when I want to demo a running web page. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.codeproject.com/KB/GDI-plus/NGif.aspx"&gt;http://www.codeproject.com/KB/GDI-plus/NGif.aspx&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;This one seems to work, though it has only given&amp;nbsp;only minimal explanations. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Animated &amp;quot;Wait&amp;quot; image and long-running progress&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;There are so many progress-bar type of applications, however, this one is breathtakingly simple and ingenious.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.eggheadcafe.com/tutorials/aspnet/87272b03-adec-45e1-b157-b21da3714dfd/aspnet-animated-gifs-and.aspx"&gt;http://www.eggheadcafe.com/tutorials/aspnet/87272b03-adec-45e1-b157-b21da3714dfd/aspnet-animated-gifs-and.aspx&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29635" width="1" height="1"&gt;</description></item><item><title>AJAX: JavaScript, or ASP .net AJAX or JQuery</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/21/ajax-javascript-or-asp-net-ajax-or-jquery.aspx</link><pubDate>Tue, 21 Oct 2008 19:10:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29572</guid><dc:creator>xxxd</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29572</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/21/ajax-javascript-or-asp-net-ajax-or-jquery.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;There are hundreds of AJAX frameworks and libraries. And the number is still growing (Face it, because the web, with the demand of rich data and fast, smooth user experience, is AJAXified overnight).&lt;/p&gt;
&lt;div&gt;&amp;nbsp;However, I only know three: JavaScript AJAX, JQuery, and ASP.net AJAX.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;JavaScript AJAX uses the very raw XMLHttpRequest. It&amp;#39;s quite wordy, and needs to be always careful with different browser traps. That is, you always have to detect if XMLHttpRequest is supported, as such:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var request;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (window.XMLHttpRequest())&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request = new XMLHttpRequest();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(window.ActiveXObject)&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request = new ActiveXObject(&amp;quot;Msxml2.XMLHTTP&amp;quot;)&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; else&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // throw an error here&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;ASP .net ajax&amp;nbsp;is the Microsoft /asp .net team&amp;#39;s approach to AJAX. It uses a ScriptManager and carries with it the quite bulk ASP .net ajax library. In the beginning, UpdatePanel, a partial postback web page refreshing model, plays a big role in ASP .net ajax, however, because of the heavy toll it exerts on bandwidth and performance, most people have abandoned its usage. ASP .net AJAX makes calling web service easy, and you get to use many of nice features in asp .net, such as membership, profile system. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;JQuery has a number of functions that made AJAX easy. And as it is the case with JQuery, it is lightweighted and succinct. The list of functions are:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;$.load (url, parameters, callback) : to load&amp;nbsp;server response data&amp;nbsp;to an element&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;$.get (url, parameters, callback): GET request with parameters&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;$.post (url, parameters, callback): POST request with paramenters&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;$.getJSON(url, parameters, callback): send a get request, response is interpreted as a JSON string&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;$.ajax (options) : send AJAX request with a number of options, including url, type, dataType, timeout, global, contentType, etc.&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29572" width="1" height="1"&gt;</description></item><item><title>JQuery, the very very basics - Lesson 6</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/21/jquery-the-very-very-basics-lesson-6.aspx</link><pubDate>Mon, 20 Oct 2008 21:12:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29552</guid><dc:creator>xxxd</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29552</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/21/jquery-the-very-very-basics-lesson-6.aspx#comments</comments><description>&lt;div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-5.aspx"&gt;JQuery, the very very basics - Lesson 5 &lt;/a&gt;(Special Effects)&lt;a href="http://dotnetslackers.com/Community/blogs/xun/Disorders4.gif"&gt;&lt;img border="0" width="175" src="http://dotnetslackers.com/Community/blogs/xun/Disorders4.gif" height="270" style="border:1px solid black;margin-left:5px;margin-right:5px;float:right;" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-4.aspx"&gt;JQuery, the very very basics - Lesson 4&lt;/a&gt;&amp;nbsp;(Event handling)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx"&gt;JQuery, the very very basics - Lesson 3&lt;/a&gt; (Elements manipulation)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-2.aspx"&gt;JQuery, the very very basics - Lesson 2&lt;/a&gt; (Elements styling)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-1.aspx"&gt;JQuery, the very very basics - Lesson 1&lt;/a&gt;&amp;nbsp;(The magic $ and selectors)&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;On with my JQuery learning series.&amp;nbsp; &lt;/div&gt;
&lt;p&gt;For every programming language, there is invariably string manipulation and array fiddling. No exception with JQuery. Being unobtrusive in principal and&amp;nbsp;complimentary in&amp;nbsp;nature, it does not try to replace&amp;nbsp;the existing bulk of JavaScript functions with its own, rather, it simply adds some of the most sorely missed functions. &amp;nbsp;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;Trimming a string: $.trim(value)&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;In dealing with strings, JavaScript already has quite a comprehensive set of functions, such as &lt;span style="background-color:#ff9966;"&gt;split, substr, charAt&lt;/span&gt; (see references at &lt;a target="_blank" href="http://www.w3schools.com/jsref/jsref_obj_string.asp"&gt;http://www.w3schools.com/jsref/jsref_obj_string.asp&lt;/a&gt;), however, for&amp;nbsp;some&amp;nbsp;mysterious reasons, it does not have a trim function&amp;nbsp;for ridding of leading and trailing white space. Smart and generous people have contributed to the web various versions of their trim functions. Such as:&lt;/div&gt;
&lt;blockquote style="margin-right:0px;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;var&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; trimmed = str.replace(/^\s+|\s+$/g, &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;) ; &lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;It works perfectly. However, how about simply call trim()&amp;nbsp;function provided by JQuery? The syntax is $.trim(value)&amp;nbsp;&lt;/div&gt;
&lt;blockquote style="margin-right:0px;"&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;var&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; trimmed &lt;/span&gt;= $.trim(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot; this really needs to be trimmed &amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;Clean and plain English, right?&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;Array functions: &lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;$.each (container, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;In JQery,&amp;nbsp;in addition&amp;nbsp;to the conventional JavaScript array&amp;nbsp;(array of strings,&amp;nbsp;numerics, elements), there is also specifically&amp;nbsp;object array in the form of key-value pairs. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;The former array is coded as:&lt;span style="font-size:x-small;color:#0000ff;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;blockquote style="margin-right:0px;"&gt;
&lt;div&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;var&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; arr = [ &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;one&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;two&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;three&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;four&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;five&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; ];&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;&amp;nbsp;The later (each pair seperated by a colon &lt;strong&gt;:&lt;/strong&gt;)&lt;strong&gt; &lt;/strong&gt;:&lt;/div&gt;
&lt;blockquote style="margin-right:0px;"&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;var&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; obj = { item1: &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;one&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, item2: &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;two&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; ,item3: &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;three&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, item4: &lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;four&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;};&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;It has always been easy to loop through an JavaScript array. However, it can be easier&amp;nbsp;with&amp;nbsp;the JQuery&amp;nbsp;$.each function. The syntax is
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$.each (container, &lt;em&gt;callback&lt;/em&gt;).&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt; &lt;/span&gt;The callback function&amp;nbsp;receives&amp;nbsp;two arguments with the passing of each element:&amp;nbsp;with&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;[]&lt;/span&gt; type (traditional JavaScript) array, index and value; with &lt;span style="background-color:#ff9966;"&gt;{}&lt;/span&gt; type (array of objects with properties), key and value.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;So&amp;nbsp;we can access JQuery array elements as such (forgive me for using so many alerts):&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code1.gif"&gt;&lt;img border="0" width="574" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code1.gif" height="192" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;$.grep (array, callback, &lt;em&gt;invert&lt;/em&gt;)&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;JQuery offers a&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;$.grep()&lt;/span&gt; function to return an array of elements that matches a&amp;nbsp;certain condition.&amp;nbsp;The callback function is passed two parameters: the current value and its index. For example,&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code2.gif"&gt;&lt;img border="0" width="664" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code2.gif" height="156" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;$.map (array, callback)&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;One convenient function to transform all of the elements in an array in one shot. Change a string array into a numeric array? Yes; Change the numeric array back to a string array? Yes; Add a 10 to every number in an array? Yes.&amp;nbsp;Just call the &lt;span style="background-color:#ff9966;"&gt;$.map&lt;/span&gt; function.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;For example:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code3.gif"&gt;&lt;img border="0" width="378" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code3.gif" height="82" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Other extremely useful JQuery array functions&lt;/strong&gt; are:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;$.inArray(value, array),&lt;/span&gt;&lt;/strong&gt; returns the position of the first occurance of the element by a specified value. As in: &lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code4.gif"&gt;&lt;img border="0" width="518" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code4.gif" height="38" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;strong&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code4.gif"&gt;&lt;/a&gt;$.unique(array)&lt;/strong&gt;&lt;/span&gt;, returns a deduplicated array. As in: &lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code5.gif"&gt;&lt;img border="0" width="499" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code5.gif" height="36" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code4.gif"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;strong&gt;$.makeArray(object)&lt;/strong&gt;&lt;/span&gt;, create an array out of a selected elements. As in:&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code7.gif"&gt;&lt;img border="0" width="376" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code7.gif" height="36" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;strong&gt;$.extend(targe&lt;/strong&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code5.gif"&gt;&lt;/a&gt;&lt;strong&gt;t, source1, source2, ... sourceN)&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;,&lt;/strong&gt; extends the&amp;nbsp;target object with the&amp;nbsp;properties of the sources. For example:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="font-size:x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery6_code6.gif"&gt;&lt;img border="0" width="457" src="http://dotnetslackers.com/Community/blogs/xun/jquery6_code6.gif" height="120" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f21%2fjquery-the-very-very-basics-lesson-6.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f21%2fjquery-the-very-very-basics-lesson-6.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29552" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>Good links: ASP .NET and JQuery</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/15/good-links-asp-net-and-jquery.aspx</link><pubDate>Wed, 15 Oct 2008 16:49:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29503</guid><dc:creator>xxxd</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29503</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/15/good-links-asp-net-and-jquery.aspx#comments</comments><description>&lt;p&gt;Found a great bunch of links about&amp;nbsp;using JQuery&amp;nbsp;with asp .net&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/"&gt;&lt;span style="color:#0066cc;"&gt;Using jQuery to directly call ASP.NET AJAX page methods&lt;/span&gt;&lt;/a&gt; &lt;a target="_blank" href="http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/"&gt;&lt;span style="text-decoration:none;text-underline:none;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://encosia.com/"&gt;encosia.com&lt;/a&gt; &amp;mdash;&lt;/span&gt; An example of how to use jQuery to call an &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; AJAX page method, without using a ScriptManager. &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/"&gt;&lt;span style="color:#0066cc;"&gt;Using jQuery to consume ASP.NET JSON Web Services&lt;/span&gt;&lt;/a&gt; &lt;a target="_blank" href="http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/"&gt;&lt;span style="text-decoration:none;text-underline:none;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://encosia.com/"&gt;encosia.com&lt;/a&gt; &amp;mdash;&lt;/span&gt; An overview of consuming &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; web services that are JSON serialized by the &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; AJAX extensions, including a specific example of using jQuery to do so.&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://www.dexign.net/post/2008/07/16/jQuery-To-Call-ASPNET-Page-Methods-and-Web-Services.aspx"&gt;&lt;span style="color:#0066cc;"&gt;Using jQuery To Call ASP.NET Page Methods and Web Services&lt;/span&gt;&lt;/a&gt; &lt;a target="_blank" href="http://www.dexign.net/post/2008/07/16/jQuery-To-Call-ASPNET-Page-Methods-and-Web-Services.aspx"&gt;&lt;span style="text-decoration:none;text-underline:none;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://dexign.net/"&gt;dexign.net&lt;/a&gt; &amp;mdash;&lt;/span&gt; Seems like more and more &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; devs are using jQuery. There are similar things on DNK but none that actually do provide code that uses jQuery to callback.&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://ferry.ferryandtheria.com/?p=3"&gt;&lt;span style="color:#0066cc;"&gt;Integrating jQuery with ASP.NET&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;An alternative AJAX solution to use jQuery instead of &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; AJAX&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://codeclimber.net.nz/archive/2008/05/14/How-to-manage-ASP.NET-validation-from-Javascript-with-jQuery.aspx"&gt;&lt;span style="color:#0066cc;"&gt;How to manage ASP.NET validation from Javascript with jQuery&lt;/span&gt;&lt;/a&gt; &lt;a target="_blank" href="http://codeclimber.net.nz/archive/2008/05/14/How-to-manage-ASP.NET-validation-from-Javascript-with-jQuery.aspx"&gt;&lt;span style="text-decoration:none;text-underline:none;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://codeclimber.net.nz/"&gt;codeclimber.net.nz&lt;/a&gt; &amp;mdash;&lt;/span&gt; This article outlines how to enable and disable &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; client side validation from Javascript using jQuery&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://www.chrisvandesteeg.nl/2007/12/19/ajax-and-json-for-aspnet-mvc-with-jquery/"&gt;&lt;span style="color:#0066cc;"&gt;Ajax and json for ASP.NET MVC with jQuery&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://chrisvandesteeg.nl/"&gt;chrisvandesteeg.nl&lt;/a&gt; &amp;mdash;&lt;/span&gt; an example project that uses the jQuery library to create an ajax enabled &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; MVC website. Generally what this project does: * Load views through ajax (with back-button support) * Do ajax-style form-posts and retrieve only the messages, errors and updated content * Do json form-posts and retrieve the errors an &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/"&gt;&lt;span style="color:#0066cc;"&gt;3 mistakes to avoid when using jQuery with ASP.NET AJAX&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://encosia.com/"&gt;encosia.com&lt;/a&gt; &amp;mdash;&lt;/span&gt; Three common problems that I&amp;#39;ve seen when using jQuery with &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; AJAX, their underlying causes, and simple solutions to them.&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://weblogs.asp.net/bradvincent/archive/2008/04/28/better-jquery-intellisense-in-vs2008.aspx"&gt;&lt;span style="color:#0066cc;"&gt;(Better) JQuery IntelliSense in VS2008&lt;/span&gt;&lt;/a&gt; &lt;a target="_blank" href="http://weblogs.asp.net/bradvincent/archive/2008/04/28/better-jquery-intellisense-in-vs2008.aspx"&gt;&lt;span style="text-decoration:none;text-underline:none;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://weblogs.asp.net/"&gt;weblogs.asp.net&lt;/a&gt; &amp;mdash;&lt;/span&gt; If you are like me and you&amp;#39;ve read the many articles about how to get other javascript libraries to work in VS2008, you&amp;#39;ll know that all you really need to do is install the visual studio HOTFIX. &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;a target="_blank" href="http://www.west-wind.com/weblog/posts/300754.aspx"&gt;&lt;span style="color:#0066cc;"&gt;Client Side Templating with jQuery&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="color:#808080;"&gt;&lt;a target="_blank" href="http://west-wind.com/"&gt;west-wind.com&lt;/a&gt; &amp;mdash;&lt;/span&gt; When building AJAX applications there&amp;#39;s often the requirement to choose between client and server side rendering. Server side &lt;a target="_blank" href="http://asp.net/"&gt;ASP.NET&lt;/a&gt; controls provide rich templating, but updating those controls on the client can be difficult. Or is it? Here&amp;#39;s one approach using jQuery and HTML templates in markup script to dynamically create complex layout on the client without writing reams of script code. &lt;/p&gt;
&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f15%2fgood-links-asp-net-and-jquery.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f15%2fgood-links-asp-net-and-jquery.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29503" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/asp+.net+ajax/default.aspx">asp .net ajax</category><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>JQuery, the very very basics - Lesson 5</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/13/jquery-the-very-very-basics-lesson-5.aspx</link><pubDate>Mon, 13 Oct 2008 17:17:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29484</guid><dc:creator>xxxd</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29484</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/13/jquery-the-very-very-basics-lesson-5.aspx#comments</comments><description>&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/aman352l.gif"&gt;&lt;/a&gt;&lt;a&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;On with our journey of learning JQuery. Thanks to all of you who has stayed and&amp;nbsp;cheered&amp;nbsp;me and made me&amp;nbsp;go on,&amp;nbsp;against&amp;nbsp;my own lazy nature. So far, we have slowly walked through the bunch of commands by which we select, dress up, manipulate chains of elements and make them action bound.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-4.aspx"&gt;JQuery, the very very basics - Lesson 4&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/aman352l.gif"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx"&gt;JQuery, the very very basics - Lesson 3&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-2.aspx"&gt;JQuery, the very very basics - Lesson 2&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-1.aspx"&gt;JQuery, the very very basics - Lesson 1&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;Now, let&amp;#39;s look at the tiny set of commands for special-effects: show / hide with a speed, slide up / slide down, fade in and out. After all, we are human, insatiable for animations and wow factors. (However, please do not overplay your hand. :))&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/aman352l.gif"&gt;&lt;img border="0" width="372" src="http://dotnetslackers.com/Community/blogs/xun/aman352l.gif" height="332" style="border:1px solid black;vertical-align:middle;margin:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Show / Hide, Slower and slower, then faster and faster&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Show / Hide a layer is&amp;nbsp;such a&amp;nbsp;common-place practice, yet before JQuery, I always have to&amp;nbsp;be a little verbose (and most surely I have to do a quick search and grab some code, as in this case the vicitim of my theft&amp;nbsp;is: &lt;a target="_blank" href="http://www.geocities.com/technofundo/tech/js/showhide.html"&gt;http://www.geocities.com/technofundo/tech/js/showhide.html&lt;/a&gt;&amp;nbsp;):&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery5_code1.gif"&gt;&lt;img border="0" width="638" src="http://dotnetslackers.com/Community/blogs/xun/jquery5_code1.gif" height="341" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Now, with JQuery, we can just say, (yes, you guessed it),&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;show()&lt;/span&gt; to show,&lt;span style="background-color:#ff9966;"&gt; hide()&lt;/span&gt; to hide, an element or a matched set of elements:&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;$(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;div&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).show();&lt;span style="font-size:x-small;"&gt;
&lt;div&gt;
&lt;p&gt;&lt;span style="font-size:x-small;"&gt;$(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;div&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="font-size:x-small;"&gt;).hide();&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;Of course,&amp;nbsp;we&amp;nbsp;can also tap the good&amp;nbsp;sense of &lt;span style="background-color:#ff9966;"&gt;toggle()&lt;/span&gt; command, which can detect then reverse the state of a given element.&amp;nbsp;Is it&amp;nbsp;shown now? Yes -&amp;gt;&amp;nbsp;then hide it; No -&amp;gt;&amp;nbsp;show it.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Easy.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery5_code2.gif"&gt;&lt;img border="0" width="283" src="http://dotnetslackers.com/Community/blogs/xun/jquery5_code2.gif" height="74" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;One cool thing about this&amp;nbsp;show/hide/toggle business&amp;nbsp;is that&amp;nbsp;we can now add a speed element to really&amp;nbsp;animate the magic of appearance, disappearance and reappearance. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Speed in other languages is a rare thing, however, it is a norm in JQuery. From now on, we will&amp;nbsp;speed things up and down&amp;nbsp;often and&amp;nbsp;very much&amp;nbsp;at ease, for example, slide, fade, animate, etc.&amp;nbsp;There are three predefined speeds: slow, normal and fast.&amp;nbsp;Of course&amp;nbsp;you&amp;nbsp;can always come up with a speed in measure of milliseconds&amp;nbsp;that suits you. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;The following one line of code&amp;nbsp;slowly&amp;nbsp;alternates&amp;nbsp;a layer&amp;#39;s showing and hiding. &amp;nbsp;&lt;/div&gt;
&lt;p&gt;$(&amp;#39;div#toggle&amp;#39;).toggle(&lt;span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&amp;#39;slow&amp;#39;&lt;/span&gt;&amp;quot;&amp;gt;);&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Slide up and down, fade in and out&lt;/strong&gt;&lt;/p&gt;
&lt;div&gt;Sliding up and down a layer used to be a challenge. Not anymore. Now we can just use these&amp;nbsp;tell-it-all commands: &lt;span style="background-color:#ff9966;"&gt;slideUp(speed, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;,&lt;/span&gt; &lt;span style="background-color:#ff9966;"&gt;slideDown(speed, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;.&lt;/span&gt; Of course, do not forget toggle. With sliding, the toggle command is &lt;span style="background-color:#ff9966;"&gt;slideToggle(speed, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;.&lt;/span&gt;&amp;nbsp;
&lt;p&gt;So is the case with fading in and out. The commands for&amp;nbsp;fading&amp;nbsp;are: &lt;span style="background-color:#ff9966;"&gt;fadeIn(speed, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;,&lt;/span&gt; &lt;span style="background-color:#ff9966;"&gt;fadeOut(speed, &lt;em&gt;callback&lt;/em&gt;)&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;An example:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery5_code3.gif"&gt;&lt;img border="0" width="560" src="http://dotnetslackers.com/Community/blogs/xun/jquery5_code3.gif" height="188" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All right, see you next week (I wish I could give you a Sarah Palin wink :).&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f13%2fjquery-the-very-very-basics-lesson-5.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f13%2fjquery-the-very-very-basics-lesson-5.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29484" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>JQuery, the very very basics - Lesson 4</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/02/jquery-the-very-very-basics-lesson-4.aspx</link><pubDate>Thu, 02 Oct 2008 19:22:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29289</guid><dc:creator>xxxd</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29289</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/10/02/jquery-the-very-very-basics-lesson-4.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/easy.jpg"&gt;&lt;img border="0" width="219" src="http://dotnetslackers.com/Community/blogs/xun/easy.jpg" height="298" style="border:1px solid black;float:left;margin:5px;" alt="" /&gt;&lt;/a&gt;On again with the very basics of JQuery. Thanks again for all of the kicks, dzones, stumbled-upons. I am wearing a permanent thank-you&amp;nbsp;smile now. :)&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx"&gt;JQuery, the very very basics - Lesson 3&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-2.aspx"&gt;JQuery, the very very basics - Lesson 2&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-1.aspx"&gt;JQuery, the very very basics - Lesson 1&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;Now that we have done with the selection and manipulation of JQuery elements, time for some actions (event handling). Actions, reactions, interactions, through which we learn, connect and play,&amp;nbsp;through which&amp;nbsp;web becomes an inseperable part of our lives. &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;However, it&amp;nbsp;is daunting to&amp;nbsp;create a sophisticated uniform interaction model on&amp;nbsp;the array of competing&amp;nbsp;browsers. Besides, there are different DOM event models. Admit it, how many times&amp;nbsp;have you had this Yes/No&amp;nbsp;interchange between you and&amp;nbsp;your user?&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;em&gt;Yes, it works&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No, it does not. It does not do anything. &lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What browser do you use?&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Well, JQuery shields us with a unified front for cross-browser event handling model.&amp;nbsp;It also allows&amp;nbsp;an event to be tied with or&amp;nbsp;released from&amp;nbsp;multiple event listeners. For any events (&lt;span style="background-color:#ff9966;"&gt;blur&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;change&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;click&lt;/span&gt;,&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;focus&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;keydown&lt;/span&gt; ...), we can access their properties such as&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;keyCode&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;pageX&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;pageY&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;screenX&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;screenY&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;shiftKey&lt;/span&gt;, &lt;span style="background-color:#ff9966;"&gt;target&lt;/span&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Event binding and unbinding: &lt;/strong&gt;&lt;span style="background-color:#ff9966;"&gt;bind()&lt;/span&gt; and &lt;span style="background-color:#ff9966;"&gt;unbind()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;bind(eventType, data, listener)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;So instead of attaching a click event to an&amp;nbsp;image as the following:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;img&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;=&amp;quot;img1&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;color:#ff0000;"&gt;src&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;=&amp;quot;arrowup.jpg&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;color:#ff0000;"&gt;onclick&lt;/span&gt; &lt;span style="font-size:x-small;color:#0000ff;"&gt;=&amp;quot;showMe()&amp;quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;With JQuery, we&amp;nbsp;bind&amp;nbsp;event handler(s)&amp;nbsp;using&amp;nbsp;the &lt;span style="background-color:#ff9966;"&gt;bind()&lt;/span&gt; command.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code1.gif"&gt;&lt;img border="0" width="405" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code1.gif" height="64" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;It is easy&amp;nbsp;to uniformly&amp;nbsp;handle an event&amp;nbsp;of&amp;nbsp;a matched set of elements with JQuery selectors and the &lt;span style="background-color:#ff9966;"&gt;bind()&lt;/span&gt; command.&amp;nbsp;&amp;nbsp;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;For example, modified the above code a little,&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code2.gif"&gt;&lt;img border="0" width="344" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code2.gif" height="67" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Now we have just instructed every image on a page to respond the click event.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;The &lt;span style="background-color:#ff9966;"&gt;bind()&lt;/span&gt; command can be used&amp;nbsp;to bind indefinite event handlers to&amp;nbsp;one&amp;nbsp;event.&amp;nbsp;Again,&amp;nbsp;consider the above example, change it a bit:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code3.gif"&gt;&lt;img border="0" width="567" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code3.gif" height="187" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Every coin&amp;nbsp;has&amp;nbsp;two sides. We bind then we unbind, in either of the following ways:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;unbind(eventType, listener)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;unbind(event)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Directly using event names and triggering event handlers: &lt;span style="background-color:#ff9966;"&gt;eventName()&lt;/span&gt; and &lt;span style="background-color:#ff9966;"&gt;trigger()&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;The most common-place events get first-class, convenience treatment. For these everyday, everywhere events: &lt;span style="background-color:#ff9966;"&gt;click, focus, select, submit, blur&lt;/span&gt;, we can omit the &lt;span style="background-color:#ff9966;"&gt;bind()&lt;/span&gt; command and directly&amp;nbsp;set up&amp;nbsp;handlers&amp;nbsp;for them. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;The syntax is: &lt;span style="background-color:#ff9966;"&gt;eventName(listener)&lt;/span&gt;, such as &lt;span style="background-color:#ff9966;"&gt;click ( function () { } )&lt;/span&gt; ;&lt;/div&gt;
&lt;div&gt;or simply &lt;span style="background-color:#ff9966;"&gt;eventName(),&lt;/span&gt;&amp;nbsp;such as &lt;span style="background-color:#ff9966;"&gt;click ()&lt;/span&gt; ;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;For example,&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;$(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;img&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).click(&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;function&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;(&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;event&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;) { alert(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;My id = &amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; + &lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;this&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;.id);}); &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&lt;span style="color:#000000;"&gt;$(&lt;/span&gt;&amp;#39;img#clickMe&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).click() &lt;/span&gt;&lt;span style="font-size:x-small;color:#008000;"&gt;// this fakes a click action from the image whose id = clickMe &lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;trigger(eventType)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;Sometimes it is necessary to trigger an action instead of merely responding. For example, sometimes we want programmatically trigger the action of submitting a form. How can we do it? Go trigger.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;//...&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;"&gt;trigger(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;submit&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;We can trigger&amp;nbsp;such action through the firing of another event.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code4.gif"&gt;&lt;img border="0" width="495" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code4.gif" height="118" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Toggling event handlers: &lt;span style="background-color:#ff9966;"&gt;toggle(handler1, handler2, handler3, ...)&lt;/span&gt;&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;With JQuery, convenience is the key. If there is a behavior that occurs habitually, there is bound to be a command that&amp;nbsp;helps you to do just that. Such is&amp;nbsp;case of toggling.&amp;nbsp;As you can see from the syntax of the &lt;span style="background-color:#ff9966;"&gt;toggle()&lt;/span&gt; command, you can toggle among a good number of handlers. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Toggling is good to adjust styles of a matched set of elements. First time, I turn blue; next time, I go green; then, I change to red ... until I change back to blue. Again. And again.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code5.gif"&gt;&lt;img border="0" width="431" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code5.gif" height="169" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Hovering over: &lt;span style="background-color:#ff9966;"&gt;hover(mouseoverhandler, mouseouthanlder)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;hover()&lt;/span&gt; is another example of convenience command.&amp;nbsp;We are all delighted to see hyperlinks and images change into and out of different style or images. For that, we all have been busy writing out &lt;span style="background-color:#ff9966;"&gt;mouseover()&lt;/span&gt; and &lt;span style="background-color:#ff9966;"&gt;mouseout()&lt;/span&gt; code. Now, with JQuery, we just call this command: &lt;span style="background-color:#ff9966;"&gt;hover()&lt;/span&gt;.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery4_code6.gif"&gt;&lt;img border="0" width="337" src="http://dotnetslackers.com/Community/blogs/xun/jquery4_code6.gif" height="139" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f02%2fjquery-the-very-very-basics-lesson-4.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f10%2f02%2fjquery-the-very-very-basics-lesson-4.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29289" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>JQuery, the very very basics - Lesson 3</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx</link><pubDate>Fri, 26 Sep 2008 15:07:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29171</guid><dc:creator>xxxd</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29171</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx#comments</comments><description>&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/manipulation.gif"&gt;&lt;/a&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/manipulation.gif"&gt;&lt;/a&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/manipulation.gif"&gt;&lt;/a&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/manipulation1.gif"&gt;&lt;img border="0" width="230" src="http://dotnetslackers.com/Community/blogs/xun/manipulation1.gif" height="351" style="border:0;float:left;margin-left:5px;margin-right:5px;" alt="" /&gt;&lt;/a&gt;Snail on with my learning and writing about the very very basic lessons on JQuery. Again, thanks to all of you for the kicking (ouch! yet the more the merrier), dzon-ing and reddit-ing. I am still glowing in and baffled by the attention (as little as it is. Big for me, since I am no Scott Gu) ...&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-2.aspx" class="null"&gt;&amp;nbsp;JQuery, the very very basics - Lesson 2&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-1.aspx" class="null"&gt;JQuery, the very very basics - Lesson 1&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;In &amp;quot;modern&amp;quot; (DOM) web programming, web pages are made up of a hierarchy of elements. Manipulation of elements goes far beyond styling and positioning, it involves almost everything, adding / deleting content, appending and removing children elements, attaching itself to a new parent, cloning ... Everything is possible. The question is : How?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Content manipulation: &lt;span style="background-color:#ff9966;"&gt;html()&lt;/span&gt; and &lt;span style="background-color:#ff9966;"&gt;text()&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Pretty much all JQuery commands go both ways: get and set. To access a property only, call the command without parameter; to modify, call the command with a parameter.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;html()&lt;/span&gt; returns the innerHTML property of a element; &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;html(content)&lt;/span&gt; set the element&amp;#39;s innerHTML to the content passed&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;text()&lt;/span&gt; &amp;nbsp;returns the text content (stripped of any html markups) ;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;text(content)&lt;/span&gt; changes the text content of the calling elements.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;So say for example, we have a little html code as the following:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery_3_code1.gif"&gt;&lt;img border="0" width="177" src="http://dotnetslackers.com/Community/blogs/xun/jquery_3_code1.gif" height="132" style="border:1px solid black;margin-top:5px;margin-bottom:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;table#table1&amp;#39;).html();&lt;/span&gt; // returns everything inside the table (id=table1), including the html tags&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;table#table1&amp;#39;).text();&lt;/span&gt; // however returns only the actual content (in one big unsepearable string): test1item1&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Form element values: &lt;span style="background-color:#ff9966;"&gt;val()&lt;/span&gt; &lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;To get or set values of form elements, we use &lt;span style="background-color:#ff9966;"&gt;val()&lt;/span&gt; command (in its two-way street fashion: &lt;span style="background-color:#ff9966;"&gt;val()&lt;/span&gt; for get and&lt;span style="background-color:#ff9966;"&gt; val(content)&lt;/span&gt; for set).&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;A couple of especially neat things about &lt;span style="background-color:#ff9966;"&gt;val()&lt;/span&gt; command with form element.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;blockquote style="margin-right:0px;"&gt;
&lt;div&gt;a) Remember how we used to painstakingly enumerate through a group of radios until we found the chosen one? &lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery_3_code2.gif"&gt;&lt;img border="0" width="409" src="http://dotnetslackers.com/Community/blogs/xun/jquery_3_code2.gif" height="73" style="border:1px solid black;margin:5px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Now with JQuery (with selectors and &lt;span style="background-color:#ff9966;"&gt;val()&lt;/span&gt;), we may just say:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;var selected = $(&amp;#39;input[name=selectMe]:checked&amp;#39;).val();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;b) Remember that JQuery command can always multitask, besides that it can chain up more number of commands than a chain smoker do with cigarettes?&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Here is the deal with the val(values) command. It can be used to set up values for each element in selected set in one shot.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Consider the following code:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;input&amp;#39;).val([&amp;#39;red&amp;#39;,&amp;#39;blue&amp;#39;,&amp;#39;orange&amp;#39;]);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;It will check all checkboxes or radio boxes whose value matches any of the values in the array (red, blue, orange) passed to command.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;&lt;strong&gt;Appending and inserting&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;JQuery is skilled in moving things around. And it uses exactly the same English words we do (except in&amp;nbsp;a very very economic&amp;nbsp;fashion).&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;append(something)&lt;/span&gt;: stick the &amp;quot;something&amp;quot; passed to the end of a matched set;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;appendTo(target)&lt;/span&gt;: stick everything in the selected set to the end of the target;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;prepend(something)&lt;/span&gt;: stick the &amp;quot;something&amp;quot; passed to the beginning of a matched set;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;prependTo(target)&lt;/span&gt;: stick everything in the selected set to the beginning of the target;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;before(something)&lt;/span&gt;: insert the &amp;quot;something&amp;quot; before each element of the matched set&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;insertBefore(target)&lt;/span&gt;: insert the whole matched set before the targeted set of elements&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;after(something) &lt;/span&gt;: insert the &amp;quot;something&amp;quot; after each element of the matched set&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;insertAfter(target)&lt;/span&gt; : insert the whole matched set after the targeted set of elements&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Wrapping and removing &lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Like candies that need sparkling wrapping paper, sometimes we want to wrap our element(s) in some sort of wrappers too. For this, we can use &lt;span style="background-color:#ff9966;"&gt;wrap(wrapper)&lt;/span&gt; command.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p.note&amp;#39;).wrap(&amp;quot;&amp;lt;div class=&amp;#39;note&amp;#39;&amp;gt;This is our notes section&amp;lt;/div&amp;gt;&amp;quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Flipping the coin,&amp;nbsp;we may want to remove things from a wrapper too.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;remove():&lt;/span&gt; removes all elements in a selected set. For example:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;div.note&amp;#39;).remove();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Cloning with &lt;span style="background-color:#ff9966;"&gt;clone()&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;We do cloning with clone(), then move the clone to elsewhere, chaining up with commands such as &lt;span style="background-color:#ff9966;"&gt;appendTo, insertBefore, before, after&lt;/span&gt;, etc.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;img#cloneme&amp;#39;).clone().appendTo(&amp;#39;div#gallary&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-4.aspx"&gt;JQuery, the very very basics - Lesson 4&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f26%2fjquery-the-very-very-basics-lesson-3.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f26%2fjquery-the-very-very-basics-lesson-3.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29171" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>JQuery, the very very basics - Lesson 2</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/17/jquery-the-very-very-basics-lesson-2.aspx</link><pubDate>Wed, 17 Sep 2008 18:24:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:29027</guid><dc:creator>xxxd</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=29027</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/17/jquery-the-very-very-basics-lesson-2.aspx#comments</comments><description>&lt;p&gt;Continue on with the series of lessons I learned about some of the very basics of JQuery. Thanks to all of you who has generously kicked, dzoned, redditted my first of N posts on this topic:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/13/jquery-the-very-very-basics-lesson-1.aspx" class="null"&gt;JQuery, the very very basics - Lesson 1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So it is nice to be able to use a combination of JQuery selectors to grab an array of&amp;nbsp;elements, however, it would be better&amp;nbsp;if we know&amp;nbsp;how to&amp;nbsp;inspect them&amp;nbsp;one by one&amp;nbsp;and operate on them.&lt;/p&gt;
&lt;div&gt;&amp;nbsp;&lt;strong&gt;size() and each(iterator) &lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;To&amp;nbsp;determine the size&amp;nbsp;of the set&amp;nbsp;we just selected, we use the &lt;span style="background-color:#ff9966;"&gt;size()&lt;/span&gt; command. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;For example, to list all the ids&amp;nbsp;of the&amp;nbsp;&amp;lt;p&amp;gt; elements&amp;nbsp;we just selected, we can use a &lt;span style="background-color:#ff9966;"&gt;for ..&lt;/span&gt;. loop&amp;nbsp;and the &lt;span style="background-color:#ff9966;"&gt;size()&lt;/span&gt; command:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery_code1.gif"&gt;&lt;img border="0" width="329" src="http://dotnetslackers.com/Community/blogs/xun/jquery_code1.gif" height="37" style="border:1px solid black;margin-top:10px;margin-bottom:10px;" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;To cut the chase even more, we can use the &lt;span style="background-color:#ff9966;"&gt;each()&lt;/span&gt; command, which takes a&amp;nbsp;literal function&amp;nbsp;as parameter to&amp;nbsp;deal with&amp;nbsp;each&amp;nbsp;element in the set. The element can be accessed using the &lt;span style="background-color:#ff9966;"&gt;this&lt;/span&gt; keyword. So rewrite the above code:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/jquery_code2.gif"&gt;&lt;img border="0" width="327" src="http://dotnetslackers.com/Community/blogs/xun/jquery_code2.gif" height="50" style="border:1px solid black;margin-top:10px;margin-bottom:10px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Get and set attributes&amp;#39; values&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;attr(name) and attr(name, value)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;Well, you probably have guessed it. The first &lt;span style="background-color:#ff9966;"&gt;attr()&lt;/span&gt; command lets you access the value of an attibute designated by the name, the second &lt;span style="background-color:#ff9966;"&gt;attr()&lt;/span&gt; command assign the named attribute with the value specified in the second parameter.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;For example, I have a dummy &amp;lt;p&amp;gt; element as such:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;p&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;=&amp;quot;p1&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt; &lt;/span&gt;&lt;span style="font-size:x-small;color:#ff0000;"&gt;title&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;=&amp;quot;test&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;Test, test&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;p&lt;/span&gt;&lt;span style="font-size:x-small;color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p#p1&amp;#39;).attr(&amp;#39;title&amp;#39;)&lt;/span&gt;&amp;nbsp;returns the value of the attribute title (&amp;#39;test&amp;#39;),&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p#p1&amp;#39;).attr(&amp;#39;title&amp;#39;, &amp;#39;more than a test&amp;#39;)&lt;/span&gt;&amp;nbsp;change the title&amp;#39;s value to &amp;quot;more than a test&amp;quot;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Css Style: Dress up, dress down &lt;a href="http://dotnetslackers.com/Community/blogs/xun/style.gif"&gt;&lt;img border="0" width="224" src="http://dotnetslackers.com/Community/blogs/xun/style.gif" height="386" style="float:right;margin:10px;border:black 1px solid;" alt="" /&gt;&lt;/a&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/hair_style1.jpg"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&amp;nbsp;&lt;strong&gt;addClass(names), removeClass(names) and toggleClass(name)&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;addClass&lt;/span&gt;&lt;span style="background-color:#ffffff;"&gt; dresses up all of the elements in a selected set with one css class or multiple css classes; conversely, removeClass strips off the elements one or more css classes specified by the name paramter, as in:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p.notes&amp;#39;).addClass(&amp;#39;notes&amp;#39;, &amp;#39;highlight&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;/span&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p.notes&amp;#39;).removeClass(&amp;#39;highlight&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Do not we all love to toggle, add and remove, switch and off? Well, toggleClass command does just this, add the specified css class to element(s) if it is not there, remove it if it is.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;#39;p.notes&amp;#39;).toggleClass(&amp;#39;highlight&amp;#39;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style="background-color:#ff9966;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color:#ff9966;"&gt;css(name, value)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;What if we want to change css style of elements without using any css class names? There, css command affords us to do so. &lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:x-small;"&gt;$(&amp;#39;p.note&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).css(&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;#39;background-color&amp;#39;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;, &lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&amp;#39;yellow&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="color:#000000;background-color:#ff9966;"&gt;);&lt;/span&gt; changes the background color of all &amp;lt;p&amp;gt; elements whose class name is note. &lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="font-size:small;"&gt;There are more css related commands such as &lt;span style="background-color:#ff9966;"&gt;width(value), height(value)&lt;/span&gt; to allow us to directly change elements&amp;#39; apparence, for example:&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;span style="background-color:#ff9966;"&gt;&lt;span style="font-size:x-small;"&gt;$(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;#39;p.note&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;&lt;span style="background-color:#ff9966;"&gt;).width(500).height(100);&lt;/span&gt; changes the&amp;nbsp;width&amp;nbsp;then height&amp;nbsp;of all &amp;lt;p&amp;gt; elements whose class name is note.&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx"&gt;JQuery, the very very basics - Lesson 3&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-4.aspx"&gt;JQuery, the very very basics - Lesson 4&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f17%2fjquery-the-very-very-basics-lesson-2.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f17%2fjquery-the-very-very-basics-lesson-2.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29027" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>JQuery, the very very basics - Lesson 1</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/13/jquery-the-very-very-basics-lesson-1.aspx</link><pubDate>Fri, 12 Sep 2008 20:33:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:28995</guid><dc:creator>xxxd</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=28995</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/13/jquery-the-very-very-basics-lesson-1.aspx#comments</comments><description>&lt;p&gt;JQuery is the star among the growing list of JavaScript libraries. A few of its characteristics are light-weight, cross-browser compatibility and simplicity. A task that would take 10 lines of code with traditional JavaScript can be accomplished with JQuery in just 1 line of code. For example, if&amp;nbsp;you want to dress up a table with an ID mytable with alternative color for every other row,&amp;nbsp;in query,&amp;nbsp;you can simple&amp;nbsp;do this in JQuery.&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/juery_code1.gif"&gt;&lt;img border="0" width="584" src="http://dotnetslackers.com/Community/blogs/xun/juery_code1.gif" height="99" style="border:1px solid black;margin-top:10px;margin-bottom:10px;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div style="text-align:left;"&gt;Belatedly and slowly, I warm up to JQuery, surprised by its simplicity and sensibilities. Yes, unlike ASP .net ajax libraries, where it feels like that I have to relearn everything and where I was hopelessly overwhelmed by new&amp;nbsp;terminologies, JQuery seems&amp;nbsp;to work along the logic that&amp;nbsp;we have trained our brain with traditional JavaScript and css. &lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;I write&amp;nbsp;to record the series of&amp;nbsp;very basic&amp;nbsp;lessons I learned about JQuery (my study source is the very readable book JQuery in Action).&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;The magic dollar sign ($) and a chain of operations&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;In JQuery, the most powerful character / symbol is the dollar sign. A $() function normally returns a set of objects followed by a chain of operations. An example &lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="font-size:x-small;"&gt;$(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;div.test&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).add(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;p.quote&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).html(&lt;/span&gt;&lt;span style="font-size:x-small;color:#a31515;"&gt;&amp;quot;a little test&amp;quot;&lt;/span&gt;&lt;span style="font-size:x-small;"&gt;).fadeOut();&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;Think it as a long sentence with punctuations.&amp;nbsp;Indeed it is a chain of instructions to tell the browser to do the following:&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;1) Get a div with&amp;nbsp;class name&amp;nbsp;= test&lt;/div&gt;
&lt;div style="text-align:left;"&gt;2) Insert a paragraph with&amp;nbsp;class name&amp;nbsp;= quote&lt;/div&gt;
&lt;div style="text-align:left;"&gt;3) Add a little text to the paragraph&lt;/div&gt;
&lt;div style="text-align:left;"&gt;4) Operate on the DIV using a predefined method called fadeOut&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;So there it is, the first two basics: $() and chainable&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;Selectors:&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/select.gif"&gt;&lt;img border="0" width="224" src="http://dotnetslackers.com/Community/blogs/xun/select.gif" height="346" style="border:1px solid black;margin-left:10px;margin-right:10px;float:right;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;1.&amp;nbsp;css selectors&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;We dress up web pages with css stylesheets, css stylesheets dress up&amp;nbsp;DOM elements by&amp;nbsp;DOM hieriachies:&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;body, table, p, input&lt;/span&gt;; or by&amp;nbsp;element&amp;nbsp;ID, since&amp;nbsp;all&amp;nbsp;ids are unique; or class names.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;JQuery uses the same set of css retrieval methods to single out one element or a group of elements, and normally we use a combination of them to cut the chase. For example:&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p.note&amp;quot;)&lt;/span&gt; returns all &amp;lt;p&amp;gt; elements whose class name = note&lt;/div&gt;
&lt;div style="text-align:left;"&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p#note&amp;quot;)&lt;/span&gt; returns&amp;nbsp;the &amp;lt;p&amp;gt; element whose&amp;nbsp;id = note&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align:left;"&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p&amp;quot;)&lt;/span&gt; returns&amp;nbsp;all p elements&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;2. child, container, attributes selectors&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;To select a child or children, we use the right angle bracket (&amp;gt;), as in&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p &amp;gt; a&amp;quot;),&lt;/span&gt; which returns all&amp;nbsp;of the href link with &amp;lt;p&amp;gt; element&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;To select element(s) with certain attributes, we use [], as in&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;input[type=text],&lt;/span&gt; returns all text input elements whose type is text&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;To select a container of some other elements, we use has keyword, for example:&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p:has(a)&amp;quot;),&lt;/span&gt; returns &amp;lt;p&amp;gt; &lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;3. Position based selectors&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;JQuery&amp;nbsp;allows&amp;nbsp;us to select element&amp;nbsp;by their relative order, as in:&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;$(&amp;quot;p:first&amp;quot;)&lt;/span&gt; returns the first &amp;lt;p&amp;gt; element&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;the predefined positions are&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;first, last, first-child, only-child, nth-child(n), nth-child(even), nth-child(odd)&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;
&lt;div style="text-align:left;"&gt;first, last, first-child, only-child, nth-child(n), nth-child(even), nth-child(odd)&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;All of them are self explanatory&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;strong&gt;4. Custom Selectors&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;The above selector seems to have provided everything we need. However, there is more that JQuery can offer. It allows us to do custom selections using the following keyword:&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;animated, button, checkbox, checked, disabled, enabled, header, hidden, image, input, not(filter), parent, password, radio, reset, selected, submit, text, visible&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&lt;span style="background-color:#ff9966;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align:left;"&gt;
&lt;div style="text-align:left;"&gt;Again, nothing fancy, plain English, right?&lt;/div&gt;
&lt;div style="text-align:left;"&gt;&amp;nbsp;
&lt;div&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-2.aspx"&gt;JQuery, the very very basics - Lesson 2&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-3.aspx"&gt;JQuery, the very very basics - Lesson 3&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/26/jquery-the-very-very-basics-lesson-4.aspx"&gt;JQuery, the very very basics - Lesson 4&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f13%2fjquery-the-very-very-basics-lesson-1.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f13%2fjquery-the-very-very-basics-lesson-1.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28995" width="1" height="1"&gt;</description><category domain="http://dotnetslackers.com/Community/blogs/xun/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>Bill Gates the comic man</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/12/bill-gates-the-comic-man.aspx</link><pubDate>Fri, 12 Sep 2008 16:31:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:28992</guid><dc:creator>xxxd</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=28992</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/12/bill-gates-the-comic-man.aspx#comments</comments><description>&lt;p&gt;I thought Bill Gates was out saving the world, now that he has officially taken the full-time job as the chairman of Melinda and Gates Foundation and that he is now in full swing promoting creative capitalism, something&amp;nbsp;about advancing common social good while also making profits. &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Turned out, Bill Gates can never quit from Microsoft. Now he i&lt;a href="http://dotnetslackers.com/Community/blogs/xun/gates_seinfeld_280x210_270x202.jpg"&gt;&lt;img border="0" width="257" src="http://dotnetslackers.com/Community/blogs/xun/gates_seinfeld_280x210_270x202.jpg" height="181" style="float:right;margin:10px;border:black 1px solid;" alt="" /&gt;&lt;/a&gt;s starring side by side with Jerry Seinfield prompting, what else? Microsoft windows. The ads are so subtle, so nothing, actually it is not clear what the two men were trying to do other than for being wierdly funny.&lt;/p&gt;
&lt;p&gt;In the first ads, Gates twisted his shoes and wriggled his butt; in the second, Gates made dead-pan complaints about food and played powered-out robots. I think he is quite good as an actor, mild-mannered, taciturn. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/180px-Get_a_Mac_ad_characters.jpg"&gt;&lt;img border="0" width="180" src="http://dotnetslackers.com/Community/blogs/xun/180px-Get_a_Mac_ad_characters.jpg" height="158" style="border:1px solid black;float:left;margin:10px;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Many people are puzzled or even angered by the lack of point of the ads. On the other hand, many people raved and are still raving about the Mac Vs. Microsoft ad, where a young lad (good looking, lean, supposedly cool. To me he looked like a Chinese young man in the fifties) called Mac coolly sizes up a happy, clumsy, untidy middle-aged man called PC. The ad ends with a line &amp;quot;Switch to Mac&amp;quot; (or something like that.)&lt;/p&gt;
&lt;p&gt;I personally do not find the ads that good. Cannot find any reason that Mac has such a sense of superiority. I cannot stand a Mac computer, with which even word processing becomes a challenge.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f12%2fbill-gates-the-comic-man.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f12%2fbill-gates-the-comic-man.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28992" width="1" height="1"&gt;</description></item><item><title>New updates to ADC controls (ADC series - Part IV)</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/05/newly-updates-to-adc-controls-adc-series-part-iv-recent-updates-of-adc.aspx</link><pubDate>Thu, 04 Sep 2008 20:07:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:28848</guid><dc:creator>xxxd</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=28848</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/05/newly-updates-to-adc-controls-adc-series-part-iv-recent-updates-of-adc.aspx#comments</comments><description>&lt;div&gt;When ADC was first released, it had an pretty impressive set of features, sorting, paging, animation, dragging and dropping, client-side databinding. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;As&amp;nbsp;time went by, ADC team has added bits and pieces of updates.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;1.&amp;nbsp;Enable referencing to an ADC control using its client-name. Sonu uploaded the changes on July 18, 2008. Because it is no fun to reference your control using $find(&amp;quot;gridview1&amp;quot;), now instead, you&amp;nbsp;can directly bind a datasource to ADC by its ID, for example:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Gridview1.DataSource = myDataSource.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;2. Add onMouseOver, onMouseOut as part of the ADC controls&amp;#39; events, so instead of manully attaching the&amp;nbsp;mouseOver events to a GridView&amp;#39;s RowCreatedEvent, coding like the following:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;//change css style of a gridview row when mouse over/mouse out&lt;/div&gt;
&lt;div&gt;function onRowCreated(sender, e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if (e.get_row().get_isDataRowType())&lt;/div&gt;
&lt;div&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp; var row = e.get_row();&lt;/div&gt;
&lt;div&gt;&amp;nbsp; var tr = row.get_container();&lt;br /&gt;&amp;nbsp; &lt;/div&gt;
&lt;div&gt;&amp;nbsp; tr.onmouseover = function(){ this.className = &amp;#39;rowMouseOver&amp;#39; };&lt;br /&gt;&amp;nbsp; tr.onmouseout = function(){ this.className = &amp;#39;rowMouseOut&amp;#39; };&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;We do the following:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;lt;AjaxData:GridView ID=&amp;quot;GridView1&amp;quot; runat=&amp;quot;server&amp;quot; CssClass=&amp;quot;DataWebControlStyle&amp;quot; CellSpacing=&amp;quot;0&amp;quot; CellPadding=&amp;quot;3&amp;quot;&amp;nbsp;&lt;span style="background-color:#ffff66;"&gt;RowMouseOverEvent=&amp;quot;onRowMouseOver&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowMouseOutEvent=&amp;quot;onRowMouseOut&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffff66;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;span style="background-color:#ffffff;"&gt;Of course, you have to define you own onRowMouseOver and onRowMouseOut functions.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;function onRowMouseOver(sender, e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;...&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;strong&gt;Putting it all together, an example of GridView with MouseOver / MouseOut events:&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/mouseovercode.gif"&gt;&lt;img border="0" width="516" src="http://dotnetslackers.com/Community/blogs/xun/mouseovercode.gif" height="750" style="border:1px solid black;margin:10px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;See it how it runs:&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/mouseover.gif"&gt;&lt;img border="0" src="http://dotnetslackers.com/Community/blogs/xun/mouseover.gif" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;please read my other posts about ADC:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;Who is afraid of ADC? - Introduction to AJAX Data Controls&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/08/26/who-is-afraid-of-adc-introduction-to-ajax-data-controls-part-iii.aspx" class="null"&gt;Part III&lt;/a&gt;&lt;br /&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/archive/2008/08/14/what-is-afraid-of-adc.aspx" class="null"&gt;Part II&lt;br /&gt;Part I&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f05%2fnewly-updates-to-adc-controls-adc-series-part-iv-recent-updates-of-adc.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f05%2fnewly-updates-to-adc-controls-adc-series-part-iv-recent-updates-of-adc.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28848" width="1" height="1"&gt;</description></item><item><title>Chrome the new browser</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/03/chrome-the-new-browser.aspx</link><pubDate>Wed, 03 Sep 2008 17:48:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:28823</guid><dc:creator>xxxd</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=28823</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/09/03/chrome-the-new-browser.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/googlechrome.jpg"&gt;&lt;/a&gt;When browser usage is tipping toward to FireFox, Microsoft released IE 8 last week, yesterday Google launched Chrome, formally stepped into the browser battlefield.&lt;/p&gt;
&lt;div&gt;I like my IE 7 enough I did not bother with IE 8. However, I was curious to see what Chrome can do and how. I went to&amp;nbsp;its download page. Immediately I was hit by an error and was asked whether to debug. I chose yes, and the following is the&amp;nbsp;debugging screen:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dotnetslackers.com/Community/blogs/xun/googlechrome.jpg"&gt;&lt;img border="0" width="703" src="http://dotnetslackers.com/Community/blogs/xun/googlechrome.jpg" height="289" style="border:1px solid black;margin-top:10px;margin-bottom:10px;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Probably it is just me. Searching around no one complained. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;.....................................................................................&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;What do people say about IE, FireFox and Chrome&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Chrome: fast and simple. However, it lacks some key features, such as bookmarking. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;FireFox: fast, secure and&amp;nbsp;snappy interface.&amp;nbsp;It started tab browsing, which was adopted by IE 7. The best adds-on to me is the FireBug, which provides a rich set of debugging features. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;IE: IE suffers the same fate as other products in the Microsoft family. Many people has a visceral dislike about anything Microsoft. I like it and am happy to be one of the 70% of people who is using Internet Explorer.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;What holds in the future?&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Rome was not built in one day. Even as FireFox&amp;nbsp;has gradually won over users at the expense of IE, it still has no more than 30% of the market share, Chrome likely has a long way to go. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f03%2fchrome-the-new-browser.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f09%2f03%2fchrome-the-new-browser.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28823" width="1" height="1"&gt;</description></item><item><title>Go with the flow</title><link>http://dotnetslackers.com/Community/blogs/xun/archive/2008/08/29/go-with-the-flow.aspx</link><pubDate>Fri, 29 Aug 2008 12:04:00 GMT</pubDate><guid isPermaLink="false">6afe0437-14b4-41d5-bc66-6d54a24dbd48:28756</guid><dc:creator>xxxd</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://dotnetslackers.com/Community/blogs/xun/rsscomments.aspx?PostID=28756</wfw:commentRss><comments>http://dotnetslackers.com/Community/blogs/xun/archive/2008/08/29/go-with-the-flow.aspx#comments</comments><description>&lt;p&gt;Go with the flow. People say. However, it&amp;nbsp;is not easy to go&amp;nbsp;with the flow, especially the flow branchs out into&amp;nbsp;five-tooth-fork.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I started web programming in 2003. I used asp then.&amp;nbsp;Now five years later, asp was&amp;nbsp;ditched&amp;nbsp;and much ridiculed, asp .net has moved from 1.0 to 3.5. It took me a&amp;nbsp;while, a long while, to&amp;nbsp;wholeheartedly&amp;nbsp;embrace&amp;nbsp;asp .net.&amp;nbsp;The learning curve&amp;nbsp;was deep,&amp;nbsp;programming became an exercise&amp;nbsp;of&amp;nbsp;discovering available properties and methods. &amp;nbsp;However, once I was up above the curve, I felt great and appreciative of what asp .net offers: a comprehensive&amp;nbsp;framework&amp;nbsp;that is flexible,&amp;nbsp;scalable, with many&amp;nbsp;tools big and small&amp;nbsp;for pick and use. &lt;/p&gt;
&lt;p&gt;Season turns, time flies. &lt;/p&gt;
&lt;p&gt;In marching to the .net world was ASP .net AJAX.&amp;nbsp;ASP .net AJAX is a complete departure from the asp .net server-centric model,&amp;nbsp;now server&amp;#39;s role&amp;nbsp;is pretty much limited to&amp;nbsp;that of a data-provider and&amp;nbsp;client script takes over&amp;nbsp;the rest of tasks&amp;nbsp;such as&amp;nbsp;event-responding,&amp;nbsp;data-dressing. For this purpose,&amp;nbsp;asp .net releases&amp;nbsp;a quite bulky&amp;nbsp;asp .net AJAX library. It also introduces a&amp;nbsp;quick&amp;nbsp;and dirty&amp;nbsp;control&amp;nbsp;updatePanel&amp;nbsp;for a partial page refreshing. Most people have realized&amp;nbsp;that updatePanel&amp;nbsp;is a dangerous entity, it incurs heavy perfomance penality, complicates&amp;nbsp;a page&amp;#39;s control tree, and&amp;nbsp;posts all unnecessary bits&amp;nbsp;back to server.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then there is MVC (model-control-view). It is not really that new and it has just released its fifth version. MVC again represents a modal, new mentality. It does not resemble in any way with the now &amp;quot;legacy&amp;quot; model of&amp;nbsp;asp .net web form application. The &lt;i&gt;model&lt;/i&gt; represents the information (the data) and the business rules used to manipulate the data; the &lt;i&gt;view&lt;/i&gt; corresponds to elements of the user interface such as text, checkbox items, and so forth; and the &lt;i&gt;controller&lt;/i&gt; manages details involving the communication to the model of user actions such as keystrokes and &lt;a href="http://dotnetslackers.com/wiki/Mouse_(computing)" title="Mouse (computing)"&gt;mouse&lt;/a&gt; movements. This architectural pattern is new. The url rerouting used in controller is new. MVC ushers in a new framework.&lt;/p&gt;
&lt;p&gt;Microsoft is battling on all fronts.&amp;nbsp;Silverlight is a product&amp;nbsp;of the battle against ADOBE&amp;#39;s flash,&amp;nbsp;which now made the very, very popular YouTube.&amp;nbsp;Looks like that Silverlight has not&amp;nbsp;made much ground at the expense of FLASH. But sure, Silverlight is a new baby too, even though now it is into its second release.&amp;nbsp;Officially, &amp;quot;Silverlight is a cross-browser, cross-platform, and cross-device plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web.&amp;quot; &lt;/p&gt;
&lt;p&gt;Whatever that means?&lt;/p&gt;
&lt;p&gt;Of course, there is more. There is always more.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f08%2f29%2fgo-with-the-flow.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fdotnetslackers.com%2fCommunity%2fblogs%2fxun%2farchive%2f2008%2f08%2f29%2fgo-with-the-flow.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28756" width="1" height="1"&gt;</description></item></channel></rss>