<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ajaxBlender.com&#8212; A Whole Lot of AJAX! Directory for Web 2.0 AJAX scripts, demos and tutorials. Custom AJAX Coding Service for Your Web 2.0 Website.</title>
	<atom:link href="http://www.ajaxblender.com/tag/tutorial/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxblender.com</link>
	<description>A Whole Lot of AJAX!</description>
	<lastBuildDate>Mon, 02 May 2011 07:38:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Add Hints &amp; Auto Focus Form Fields using jQuery</title>
		<link>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html</link>
		<comments>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html#comments</comments>
		<pubDate>Fri, 19 Feb 2010 15:52:16 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1128</guid>
		<description><![CDATA[This tutorial teaches you how to easily add hints to your forms and auto focus fields.
We are continuing a series of quick articles for web developers which explain how to automate things during website programming. Today we will talk about forms and two usability items the every current website should have:

Auto Focus Fields. The first [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial teaches you how to easily add hints to your forms and auto focus fields.<span id="more-1128"></span></p>
<p>We are continuing a series of quick articles for web developers which explain how to automate things during website programming. Today we will talk about forms and two usability items the every current website should have:</p>
<ul>
<li><strong>Auto Focus Fields.</strong> The first field in the form should be focused by default, so that the user can start entering his password or name right after page loaded and would not have to click the field to start typing. This is a small and obvious usability items, but still a very important one.</li>
<li><strong>Hints.</strong> Forms should have quick tips for fields which requires entering data in a specific format (for example email address, phone number, date / time, etc.)</li>
</ul>
<p>So, let&#8217;s say our website have this contact form:</p>
<p><img title="screen-1" src="../wp-content/uploads/2010/02/screen-1.gif" alt="screen-1" width="370" height="218" /></p>
<h3>Auto Focus</h3>
<p>Full Name &#8211; this field will be automatically focused when the page loads, here is how it will be coded in the markup:</p>
<pre class="html">
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> name=<span class="htmlAttributeValue">&quot;fullname&quot;</span> id=<span class="htmlAttributeValue">&quot;fullname&quot;</span> class=<span class="htmlAttributeValue">&quot;auto-focus&quot;</span> /&gt;</span>
</pre>
<p>Notice the field has &#8216;auto-focus&#8217; class. This is so that any field in the form with this CSS class will be automatically focused on page load.</p>
<p>The auto focus can be implemented in JavaScript:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'<span class="phpOperator">.</span>auto-focus<span class="phpOperator">:</span>first'</span><span class="phpOperator">)</span>.focus<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>2.) Email Address (the same for phone number and message fields) &#8211; If the field does not contain any value it will show a quick tip on the required data format. When the user clicks the field, the tip will disappear and let the user enter data. Here is how it will look in the markup:</p>
<pre class="html">
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;text&quot;</span> name=<span class="htmlAttributeValue">&quot;email&quot;</span> id=<span class="htmlAttributeValue">&quot;email&quot;</span> title=<span class="htmlAttributeValue">&quot;i.e. me@example.com&quot;</span> class=<span class="htmlAttributeValue">&quot;auto-hint&quot;</span> /&gt;</span>
</pre>
<p>As you see, our hint will be stored in &#8216;title&#8217; attribute of the field. This will let user see it when the field already contains a value in it.</p>
<p>By default, the color of text in input field will be black, we need to differentiate the color of the hint and common input value. Let&#8217;s set this color in CSS:</p>
<pre class="html">
<span class="htmlStyleTag">&lt;style type=<span class="cssString">&quot;text/css&quot;</span>&gt;</span>
    <span class="cssSelector">.auto-hint {</span> <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #AAAAAA</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="htmlStyleTag">&lt;/style&gt;</span>
</pre>
<p>Now we move to JavaScript implementation. At first we should display the hint in fields which have empty values:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.focus<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
        $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpString">''</span><span class="phpOperator">)</span><span class="phpText">;</span>
        $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>And handle focus / blur events:</p>
<pre class="php">
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.blur<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span> &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span> <span class="phpOperator">!</span><span class="phpOperator">=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
       $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
       $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.addClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
$<span class="phpOperator">(</span><span class="phpString">'INPUT<span class="phpOperator">.</span>auto-hint, TEXTAREA<span class="phpOperator">.</span>auto-hint'</span><span class="phpOperator">)</span>.<span class="phpFunction">each</span><span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span><span class="phpKeyword"> return<span class="phpText">;</span></span> <span class="phpOperator">}</span>
   <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpString">''</span><span class="phpOperator">)</span><span class="phpOperator">{</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.val<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'title'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span>
   <span class="phpKeyword"> else </span><span class="phpOperator">{</span> $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'auto-hint'</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it! ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1128&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-add-hints-form-auto-focus-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Create Custom Cursors without .cur File</title>
		<link>http://www.ajaxblender.com/howto-create-custom-image-cursors.html</link>
		<comments>http://www.ajaxblender.com/howto-create-custom-image-cursors.html#comments</comments>
		<pubDate>Wed, 25 Nov 2009 14:33:10 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1095</guid>
		<description><![CDATA[Sometimes you may want to replace your cursor with a custom image or use a custom image to move with your cursor. This quick JavaScript tutorial will show you how to implement it.
The task is pretty simple. At first we should hide the default cursor for the section where we will display our custom one. [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to replace your cursor with a custom image or use a custom image to move with your cursor. This quick JavaScript tutorial will show you how to implement it.<span id="more-1095"></span><br />
The task is pretty simple. At first we should hide the default cursor for the section where we will display our custom one. Our custom cursor will actually be a DIV with an image on the background. We will use JavaScript to change the position of this DIV when the user moves the mouse over the section.</p>
<h3>The markup</h3>
<pre class="html">
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;test-area&quot;</span>&gt;</span>
     Move mouse over this area.
<span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;mycursor&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
</pre>
<p>The <strong>#test-area</strong> will be the section with our custom cursor to appear and the <strong>#mycursor</strong> will be the actual DIV with the custom cursor image. Here are a few lines of CSS code to stylize the markup:</p>
<pre class="css">
<span class="cssSelector">#test-area {</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 200px</span><span class="cssRest">;</span>
     <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue"> 3px dashed #CCCCCC</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> #FFFFFF</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 20px</span><span class="cssRest">;</span>
     <span class="cssProperty">cursor</span><span class="cssRest">:</span><span class="cssValue"> url(./blank.cur), none</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">#mycursor {</span>
     <span class="cssProperty">cursor</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue"> 97px</span><span class="cssRest">;</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 137px</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> url(<span class="cssString">"/article-sources/images/pointer-cursor.gif"</span>) no-repeat left top</span><span class="cssRest">;</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> absolute</span><span class="cssRest">;</span>
     <span class="cssProperty">display</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">left</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 10000</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<p>The code (we hope) is crystal clear but let&#8217;s stop to review one aspect. In the #test-area you see the &#8216;cursor: …&#8217; declaration. We will use this to hide the default browser cursor. The easiest way to do so is to load a blank cursor (you may <a href="http://www.ajaxblender.com/article-sources/jquery/custom-cursors/blank.cur" target="_blank">download it here</a>), but this unfortunately will not work in Chrome &amp; Opera. It will display a black rectangle in Chrome and a default pointer cursor in Opera. But since this tutorial covers other important aspects related to cursor behavior (such as how to handle mouse movement, etc.), it is still a useful topic to cover for those just starting to learn JavaScript programming. So, let&#8217;s continue ;).</p>
<p>The finishing part is to add a few lines of JavaScript code for jQuery to make our arrow follow the cursor.</p>
<pre class="php">
<span class="phpOperator">&lt;</span>script type=<span class="phpString">"text/javascript"</span><span class="phpOperator">&gt;</span>
     $<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mouseout<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.hide<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
              <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mouseenter<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.show<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
              <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span><span class="phpString">'#test-area'</span><span class="phpOperator">)</span>.mousemove<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>e<span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span><span class="phpString">'#mycursor'</span><span class="phpOperator">)</span>.css<span class="phpOperator">(</span><span class="phpString">'left'</span>, e.clientX - 20<span class="phpOperator">)</span>.css<span class="phpOperator">(</span><span class="phpString">'top'</span>, e.clientY <span class="phpOperator">+</span> <span class="phpNumber">7</span><span class="phpOperator">)</span><span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">&lt;</span>/script<span class="phpOperator">&gt;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1095&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-create-custom-image-cursors.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Convert ASCII Character to Hex, Decimal and Binary Code</title>
		<link>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html</link>
		<comments>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:38:19 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1085</guid>
		<description><![CDATA[This JavaScript tutorial explains how to convert ASCII Character to Hex, Decimal and Binary Code using JavaScript. 
Recently we were asked for a function code to convert user input to hex code which was intended to be used in a JavaScript remote terminal application. We decided to share this code and also added two more [...]]]></description>
			<content:encoded><![CDATA[<p>This JavaScript tutorial explains how to convert ASCII Character to Hex, Decimal and Binary Code using JavaScript. <span id="more-1085"></span><br />
Recently we were asked for a function code to convert user input to hex code which was intended to be used in a JavaScript remote terminal application. We decided to share this code and also added two more conversion methods to it. The methods are Character to Decimal, Character to Binary, and Decimal to Hex.</p>
<p>The below code object contains the implementation of the various methods. We hope it will be useful to others, and you may use this code in your projects without any limitations. The code can be downloaded it in a separate file <a href="http://www.ajaxblender.com/article-sources/jquery/ascii-functions/convfunctions.js" target="_blank">here</a>.</p>
<pre class="php">
<span class="phpKeyword">
var </span>Convert <span class="phpOperator">=</span> <span class="phpOperator">{</span>
     chars<span class="phpOperator">:</span> <span class="phpString">" <span class="phpOperator">!</span>\"</span>#$%&#038;amp<span class="phpText">;</span><span class="phpString">'<span class="phpOperator">(</span><span class="phpOperator">)</span>*<span class="phpOperator">+</span>'</span>-<span class="phpOperator">.</span>/0123456789<span class="phpOperator">:</span><span class="phpText">;</span><span class="phpOperator">&lt;</span><span class="phpOperator"><span class="phpOperator">=</span><span class="phpOperator">&gt;</span></span><span class="phpOperator">?</span>@ABCDEFGHIJKLMNOPQRSTUVWXYZ<span class="phpOperator">[</span>\\<span class="phpOperator">]</span>^_`abcdefghijklmnopqrstuvwxyz<span class="phpOperator">{</span><span class="phpOperator">|</span><span class="phpOperator">}</span>~<span class="phpString">",
     hex<span class="phpOperator">:</span> <span class="phpString">'0123456789ABCDEF'</span>, bin<span class="phpOperator">:</span> <span class="phpOperator">[</span><span class="phpString">'0000'</span>, <span class="phpString">'0001'</span>, <span class="phpString">'0010'</span>, <span class="phpString">'0011'</span>, <span class="phpString">'0100'</span>, <span class="phpString">'0101'</span>, <span class="phpString">'0110'</span>, <span class="phpString">'0111'</span>, <span class="phpString">'1000'</span>, <span class="phpString">'1001'</span>, <span class="phpString">'1010'</span>, <span class="phpString">'1011'</span>, <span class="phpString">'1100'</span>, <span class="phpString">'1101'</span>, <span class="phpString">'1110'</span>, <span class="phpString">'1111'</span><span class="phpOperator">]</span>,
     decToHex<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>d<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> return </span><span class="phpOperator">(</span>this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span><span class="phpOperator">(</span>d - d % 16<span class="phpOperator">)</span>/16<span class="phpOperator">)</span> <span class="phpOperator">+</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span>d % 16<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toBin<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>d <span class="phpOperator">=</span> this<span class="phpOperator">.</span>toDec<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>l <span class="phpOperator">=</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span>d % 16<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>h <span class="phpOperator">=</span> this<span class="phpOperator">.</span>hex<span class="phpOperator">.</span>charAt<span class="phpOperator">(</span><span class="phpOperator">(</span>d - d % 16<span class="phpOperator">)</span>/16<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>hhex <span class="phpOperator">=</span> "</span>ABCDEF&quot;<span class="phpText">;</span>
         <span class="phpKeyword"> var </span>lown <span class="phpOperator">=</span> l <span class="phpOperator">&lt;</span> 10 <span class="phpOperator">?</span> l <span class="phpOperator">:</span> <span class="phpOperator">(</span>10 <span class="phpOperator">+</span> hhex<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>l<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> var </span>highn <span class="phpOperator">=</span> h <span class="phpOperator">&lt;</span> 10 <span class="phpOperator">?</span> h <span class="phpOperator">:</span> <span class="phpOperator">(</span>10 <span class="phpOperator">+</span> hhex<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>h<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> return </span>this<span class="phpOperator">.</span>bin<span class="phpOperator">[</span>highn<span class="phpOperator">]</span> <span class="phpOperator">+</span> <span class="phpString">' '</span> <span class="phpOperator">+</span> this<span class="phpOperator">.</span>bin<span class="phpOperator">[</span>lown<span class="phpOperator">]</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toHex<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> return </span>this<span class="phpOperator">.</span>decToHex<span class="phpOperator">(</span>this<span class="phpOperator">.</span>toDec<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>,
     toDec<span class="phpOperator">:</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>p <span class="phpOperator">=</span> this<span class="phpOperator">.</span>chars<span class="phpOperator">.</span>indexOf<span class="phpOperator">(</span>ch<span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> return </span><span class="phpOperator">(</span>p <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> -<span class="phpNumber">1</span><span class="phpOperator">)</span> <span class="phpOperator">?</span> <span class="phpNumber">0</span> <span class="phpOperator">:</span> <span class="phpOperator">(</span>p <span class="phpOperator">+</span> 32<span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>
<span class="phpOperator">}</span><span class="phpText">;</span>
</pre>
<p>Here is how to call the above code:</p>
<pre class="php">
<span class="phpComment">//  Convert Character to Binary <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>0100 0001<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toBin<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//  Convert Character to Hex <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>41<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toHex<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//  Convert Character to Dec <span class="phpOperator">(</span>it will<span class="phpKeyword"> return </span>65<span class="phpOperator">)</span><span class="phpText">;</span>
</span>Convert.toDec<span class="phpOperator">(</span><span class="phpString">'A'</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view it an action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1085&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-convert-ascii-hex-binary-decimal.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>W3C Valid Replacement for target=&#8221;_blank&#8221;</title>
		<link>http://www.ajaxblender.com/open-links-new-window-w3c-valid-target-blank.html</link>
		<comments>http://www.ajaxblender.com/open-links-new-window-w3c-valid-target-blank.html#comments</comments>
		<pubDate>Tue, 17 Nov 2009 14:57:43 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1074</guid>
		<description><![CDATA[Using target=&#8221;_blank&#8221; for links in an HTML page will generate errors when running code through the W3C validator. Well, if you are using the older Transitional document type it would not, but errors will for sure be reported for Strict document types. An easy and quick solution is to create a JavaScript handler for your [...]]]></description>
			<content:encoded><![CDATA[<p>Using <strong>target=&#8221;_blank&#8221;</strong> for links in an HTML page will generate errors when running code through the <a title="W3C Validator" href="http://validator.w3.org/" target="_blank">W3C validator</a>. Well, if you are using the older Transitional document type it would not, but errors will for sure be reported for Strict document types. An easy and quick solution is to create a JavaScript handler for your links. This tutorials explains how to create an <strong>SEO-friendly</strong> (of course) <strong>W3С valid replacement for target=&#8221;_blank&#8221;</strong> by using only a few lines of jQuery code.<span id="more-1074"></span></p>
<p>Here are two easy solutions to solve the task. In both solutions we will walk through each link in a page and apply our handlers to them so they will open in a new window. You should use the code below in your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag, i.e.:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;head&gt;</span>
...
     <span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span>
     //    Put the code here
     <span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlOtherTag">&lt;/head&gt;</span>
</pre>
<p>Or you may save it to a separate file and link it in the <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag, i.e.:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;head&gt;</span>
...
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;path-to-js-file.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlOtherTag">&lt;/head&gt;</span>
</pre>
<h3>Solution 1</h3>
<p>While the target attribute is depreciated by W3C Strict standards, it is available via the DOM object. For the first solution, you can apply <strong>target=&#8221;_blank&#8221;</strong> via JavaScript. It will open in a new window and still be W3C valid. Here is the code:</p>
<pre class="php">
     $<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          $<span class="phpOperator">(</span><span class="phpString">'A<span class="phpOperator">[</span>rel=<span class="phpString">"_blank"</span><span class="phpOperator">]</span>'</span><span class="phpOperator">)</span>.<span class="phpFunction">each</span><span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'target'</span>, <span class="phpString">'_blank'</span><span class="phpOperator">)</span><span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<h3>Solution 2</h3>
<p>While the first solution is to apply &#8216;_blank&#8217; value to a native link&#8217;s attribute &#8216;target&#8217; via JavaScript, the second solution is to handle the click on the link and open it in a new window. Please note that both alternative methods are absolutely SEO friendly and W3C valid. The code for the second solution is:</p>
<pre class="php">
     $<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          $<span class="phpOperator">(</span><span class="phpString">'A<span class="phpOperator">[</span>rel=<span class="phpString">"_blank"</span><span class="phpOperator">]</span>'</span><span class="phpOperator">)</span>.click<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
               window<span class="phpOperator">.</span>open<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.attr<span class="phpOperator">(</span><span class="phpString">'href'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
              <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
          <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1074&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/open-links-new-window-w3c-valid-target-blank.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to Create Custom AJAX Tabs using jQuery</title>
		<link>http://www.ajaxblender.com/howto-create-custom-jquery-tabs.html</link>
		<comments>http://www.ajaxblender.com/howto-create-custom-jquery-tabs.html#comments</comments>
		<pubDate>Fri, 13 Nov 2009 18:56:29 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[tabs]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1049</guid>
		<description><![CDATA[Today&#8217;s morning started a little hot here at ajaxBlender. We had some free time before starting the production meeting, and Mike (our lead developer guy) and Justin (newbie who joined us in November) started arguing about their respective abilities of creating cross-browser markup code (HTML, CSS, JS) by hand without mistakes, but also doing it [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s morning started a little hot here at ajaxBlender. We had some free time before starting the production meeting, and Mike (our lead developer guy) and Justin (newbie who joined us in November) started arguing about their respective abilities of creating cross-browser markup code (HTML, CSS, JS) by hand without mistakes, but also doing it really fast.<span id="more-1049"></span>The exchange went a little like this:</p>
<div class="user-email">
<p><strong>J: </strong>I am sure, there is no way you can create scripts from scratch fast. First thing is you integrate the 3rd party stuff. This is easy but when you have to create your custom code, it will require time for debugging, planning the structure, etc &#8211; even for small scripts.</p>
<p><strong>M:</strong> Ha, do you want to try me? ;) You select a script and I do it. If I do it you owe me a pizza and make me coffee each morning for a week, otherwise I will for you.</p>
<p><strong>J: </strong>Hm.. Sounds good. What about ajax tabs?</p>
<p><strong>M:</strong> No problem :) How much time?</p>
<p><strong>J:</strong> 10 minutes?</p>
<p><strong>M: </strong>Great!</div>
<p>As you see, resolution to the matter involved a little fun and a wager (pizza).</p>
<p>Experience took its part &#8211; Justin lost. We recorded the process for proof ;) and now we’re posting it with a quick tutorial. You can watch Mike “cook” the code in the time-lapse YouTube video below, and you can <a href="http://www.ajaxblender.com/article-sources/jquery/ajax-tabs-example/download/ajax-tabs-demo.zip">download his AJAX tabs here</a>.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/7A2E1ope4PM&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/7A2E1ope4PM&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to see it in action.</p>
<p>Here’s the code he created:</p>
<h3>HTML</h3>
<pre class="html">
<span class="htmlOtherTag">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span>
<span class="htmlOtherTag">&lt;html xmlns=<span class="htmlAttributeValue">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;</span>
<span class="htmlOtherTag">&lt;head&gt;</span>
     <span class="htmlOtherTag">&lt;meta http-equiv=<span class="htmlAttributeValue">&quot;Content-Type&quot;</span> content=<span class="htmlAttributeValue">&quot;text/html; charset=UTF-8&quot;</span> /&gt;</span>
     <span class="htmlOtherTag">&lt;title&gt;</span>Tabs Demo<span class="htmlOtherTag">&lt;/title&gt;</span>
     <span class="htmlOtherTag">&lt;link rel=<span class="htmlAttributeValue">&quot;stylesheet&quot;</span> href=<span class="htmlAttributeValue">&quot;./main.css&quot;</span> /&gt;</span>
     <span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;./jquery-1.3.2.min.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
     <span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;./main.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlOtherTag">&lt;/head&gt;</span>
<span class="htmlOtherTag">&lt;body&gt;</span>
     <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;page&quot;</span>&gt;</span>
          <span class="htmlOtherTag">&lt;ul id=<span class="htmlAttributeValue">&quot;tabs&quot;</span>&gt;</span>
               <span class="htmlOtherTag">&lt;li&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;./tabs/tab-1.html&quot;</span>&gt;</span>Tab 1<span class="htmlAnchorTag">&lt;/a&gt;</span><span class="htmlOtherTag">&lt;/li&gt;</span>
               <span class="htmlOtherTag">&lt;li&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;./tabs/tab-2.html&quot;</span>&gt;</span>Tab 2<span class="htmlAnchorTag">&lt;/a&gt;</span><span class="htmlOtherTag">&lt;/li&gt;</span>
               <span class="htmlOtherTag">&lt;li&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;./tabs/tab-3.html&quot;</span>&gt;</span>Tab 3<span class="htmlAnchorTag">&lt;/a&gt;</span><span class="htmlOtherTag">&lt;/li&gt;</span>
          <span class="htmlOtherTag">&lt;/ul&gt;</span>
          <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;tabs-container&quot;</span>&gt;</span>
               Loading. Please Wait...
          <span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;/body&gt;</span>
<span class="htmlOtherTag">&lt;/html&gt;</span>
</pre>
<h3>CSS</h3>
<pre class="css">
<span class="cssSelector">BODY {</span>
     <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue"> 20px</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 20px</span><span class="cssRest">;</span>
     <span class="cssProperty">font-family</span><span class="cssRest">:</span><span class="cssValue"> <span class="cssString">"Lucida Grande"</span>, Arial, Helvetica, sans-serif</span><span class="cssRest">;</span>
     <span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 12px</span><span class="cssRest">;</span>
     <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #333333</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">#page {</span>
     <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue"> auto</span><span class="cssRest">;</span>
     <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue"> 1000px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs {</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> relative</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 2</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs, UL.mytabs LI {</span>
     <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">list-style</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">float</span><span class="cssRest">:</span><span class="cssValue"> left</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs LI {</span> <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 0 5px</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs LI A {</span>
     <span class="cssProperty">float</span><span class="cssRest">:</span><span class="cssValue"> left</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 7px</span><span class="cssRest">;</span>
     <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue"> 1px solid #CCCCCC</span><span class="cssRest">;</span>
     <span class="cssProperty">border-bottom</span><span class="cssRest">:</span><span class="cssValue"> 1px solid #E0E0E0</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> #F0F0F0</span><span class="cssRest">;</span>
     <span class="cssProperty">text-decoration</span><span class="cssRest">:</span><span class="cssValue"> none</span><span class="cssRest">;</span>
     <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #333333</span><span class="cssRest">;</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 22px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs LI A:HOVER, UL.mytabs LI.current A {</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> #FFFFFF</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">UL.mytabs LI.current A {</span>
     <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue"> bold</span><span class="cssRest">;</span>
     <span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 14px</span><span class="cssRest">;</span>
     <span class="cssProperty">border-bottom</span><span class="cssRest">:</span><span class="cssValue"> 1px solid #FFFFFF</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">.mytabs-container {</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> relative</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 1</span><span class="cssRest">;</span>
     <span class="cssProperty">clear</span><span class="cssRest">:</span><span class="cssValue"> both</span><span class="cssRest">;</span>
     <span class="cssProperty">border</span><span class="cssRest">:</span><span class="cssValue"> 1px solid #E0E0E0</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 10px</span><span class="cssRest">;</span>
     <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue"> -1px</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
</pre>
<h3>JavaScript</h3>
<pre class="php">
<span class="phpKeyword">
var </span>containerId <span class="phpOperator">=</span> <span class="phpString">'#tabs-container'</span><span class="phpText">;</span>
<span class="phpKeyword">
var </span>tabsId <span class="phpOperator">=</span> <span class="phpString">'#tabs'</span><span class="phpText">;</span>
$<span class="phpOperator">(</span>document<span class="phpOperator">)</span>.ready<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
     <span class="phpComment">// Preload tab on page load
</span>    <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>tabsId <span class="phpOperator">+</span> <span class="phpString">' LI<span class="phpOperator">.</span>current A'</span><span class="phpOperator">)</span>.length <span class="phpOperator">&gt;</span> <span class="phpNumber">0</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          loadTab<span class="phpOperator">(</span>$<span class="phpOperator">(</span>tabsId <span class="phpOperator">+</span> <span class="phpString">' LI<span class="phpOperator">.</span>current A'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>
     $<span class="phpOperator">(</span>tabsId <span class="phpOperator">+</span> <span class="phpString">' A'</span><span class="phpOperator">)</span>.click<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.parent<span class="phpOperator">(</span><span class="phpOperator">)</span>.hasClass<span class="phpOperator">(</span><span class="phpString">'current'</span><span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpOperator">{</span><span class="phpKeyword"> return </span>>false<span class="phpText">;</span> <span class="phpOperator">}</span>
          $<span class="phpOperator">(</span>tabsId <span class="phpOperator">+</span> <span class="phpString">' LI<span class="phpOperator">.</span>current'</span><span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'current'</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span>this<span class="phpOperator">)</span>.parent<span class="phpOperator">(</span><span class="phpOperator">)</span>.addClass<span class="phpOperator">(</span><span class="phpString">'current'</span><span class="phpOperator">)</span><span class="phpText">;</span>
          loadTab<span class="phpOperator">(</span>$<span class="phpOperator">(</span>this<span class="phpOperator">)</span><span class="phpOperator">)</span><span class="phpText">;</span>
         <span class="phpKeyword"> return </span>>false<span class="phpText">;</span>
     <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunctionKeyword">function</span> loadTab<span class="phpOperator">(</span>tabObj<span class="phpOperator">)</span><span class="phpOperator">{</span>
    <span class="phpKeyword"> if<span class="phpOperator">(</span></span><span class="phpOperator">!</span>tabObj <span class="phpOperator">|</span><span class="phpOperator">|</span> <span class="phpOperator">!</span>tabObj<span class="phpOperator">.</span>length<span class="phpOperator">)</span><span class="phpOperator">{</span><span class="phpKeyword"> return<span class="phpText">;</span></span> <span class="phpOperator">}</span>
     $<span class="phpOperator">(</span>containerId<span class="phpOperator">)</span>.addClass<span class="phpOperator">(</span><span class="phpString">'loading'</span><span class="phpOperator">)</span><span class="phpText">;</span>
     $<span class="phpOperator">(</span>containerId<span class="phpOperator">)</span>.fadeOut<span class="phpOperator">(</span><span class="phpString">'fast'</span><span class="phpOperator">)</span><span class="phpText">;</span>
     $<span class="phpOperator">(</span>containerId<span class="phpOperator">)</span>.load<span class="phpOperator">(</span>tabObj<span class="phpOperator">.</span>attr<span class="phpOperator">(</span><span class="phpString">'href'</span><span class="phpOperator">)</span>, <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          $<span class="phpOperator">(</span>containerId<span class="phpOperator">)</span>.removeClass<span class="phpOperator">(</span><span class="phpString">'loading'</span><span class="phpOperator">)</span><span class="phpText">;</span>
          $<span class="phpOperator">(</span>containerId<span class="phpOperator">)</span>.fadeIn<span class="phpOperator">(</span><span class="phpString">'fast'</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
</pre>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1049&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-create-custom-jquery-tabs.html/feed</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>How to Resize Image Proportionally using JavaScript</title>
		<link>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html</link>
		<comments>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:20:01 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner's guide]]></category>
		<category><![CDATA[image resize]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=1023</guid>
		<description><![CDATA[We&#8217;re continuing a series of &#8220;How-to’s&#8221; for JavaScript beginners. In this tutorial we will explain how to proportionally resize images. Most tutorials that we have written utilize JavaScript platforms other than MooTools, so we decided to create this one using Mootools, however the function which will resize image&#8217;s size can be used with any framework [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re continuing a series of &#8220;How-to’s&#8221; for JavaScript beginners. In this tutorial we will explain how to proportionally resize images. Most tutorials that we have written utilize JavaScript platforms other than MooTools, so we decided to create this one using Mootools, however the function which will resize image&#8217;s size can be used with any framework (i.e. jQuery, ExtJS, script.aculo.us or just plain JavaScript.)<span id="more-1023"></span></p>
<p>We will just use an <strong>&lt;img /&gt;</strong> tag to resize the images. The actual task of resizing an image proportionally is quite simple, but the most important thing is to calculate the size properly. At first, you should define the size of the bounding box (the maximum size of your image). Let&#8217;s say it will be 200&#215;200 pixels:</p>
<p><img class="alignnone size-full wp-image-1033" title="bounding-box" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/bounding-box.gif" alt="bounding-box" width="235" height="235" /></p>
<p>And we have a photo with a size larger than the bounding box (size 500&#215;313 pixels):</p>
<p><img class="alignnone size-full wp-image-1025" title="sample-image" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/sample-image.jpg" alt="sample-image" width="500" height="313" /></p>
<p>After the image resize we should get something like this:</p>
<p><img class="alignnone size-full wp-image-1034" title="resized-image" src="http://www.ajaxblender.com/wp-content/uploads/2009/11/resized-image.jpg" alt="resized-image" width="245" height="235" /></p>
<p>So that the width of the image will be 200 pixels and height will proportionally scale and become 125 pixels. The image will look smaller, but it keeps its proportions and will still look good.</p>
<p>Now let&#8217;s discuss how we will be implementing this in the code. Since we may want to reuse the code at some point in the future, it is best to create a function. First, it is smart to think of all the ways it could be used, how it will work, how you will call the function and also to determine input and output values. A little thought at this time will make the coding task simpler and ensure a more flexible product.</p>
<p>Input parameters of the function will be: <strong>maxW</strong>, <strong>maxH</strong> (these parameters will set the size of the bounding box) and <strong>currW</strong>, <strong>currH</strong> <em>(these parameters will contain current or original size of the image. In our sample it&#8217;s 500&#215;313 pixels)</em>. The function will calculate size and return an array containing two values. Usage of the function will be:</p>
<pre class="php">
<span class="phpKeyword">
var </span>newSize <span class="phpOperator">=</span> scaleSize<span class="phpOperator">(</span>200, 200, 500, 313<span class="phpOperator">)</span><span class="phpText">;</span>
alert<span class="phpOperator">(</span><span class="phpString">'New Width<span class="phpOperator">:</span> '</span> <span class="phpOperator">+</span> newSize<span class="phpOperator">[</span><span class="phpNumber">0</span><span class="phpOperator">]</span> <span class="phpOperator">+</span> <span class="phpString">', New Height<span class="phpOperator">:</span> '</span> <span class="phpOperator">+</span> newSize<span class="phpOperator">[</span><span class="phpNumber">1</span><span class="phpOperator">]</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>Now let&#8217;s implement the algorithm of the <strong>scaleSize</strong> function. The logic is simple. You just determine the widest side <em>(for landscape photos it will be width and for portrait photos it will be height)</em>, then set the size of bounding box to it and calculate the size of the opposite side using the following formula:</p>
<p><strong>For width: </strong>currH / currH / currW;<br />
<strong>For height: </strong>currW * currH / currW;</p>
<p>You will notice that <strong>currH / currW</strong> expression repeats in both calculations. This is a ratio of height to width. So, here is the actual implementation of the function:<br />
<code></p>
<pre class="php">
<span class="phpFunctionKeyword">function</span> scaleSize<span class="phpOperator">(</span>maxW, maxH, currW, currH<span class="phpOperator">)</span><span class="phpOperator">{</span>
<span class="phpKeyword">
var </span>ratio <span class="phpOperator">=</span> currH / currW<span class="phpText">;</span>
<span class="phpKeyword">
if<span class="phpOperator">(</span></span>currW <span class="phpOperator">&gt;</span><span class="phpOperator">=</span> maxW &#038;amp<span class="phpText">;</span>&#038;amp<span class="phpText">;</span> ratio <span class="phpOperator">&lt;</span><span class="phpOperator">=</span> <span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
currW <span class="phpOperator">=</span> maxW<span class="phpText">;</span>
currH <span class="phpOperator">=</span> currW * ratio;
<span class="phpOperator">}</span><span class="phpKeyword"> else </span>>if<span class="phpOperator">(</span>currH <span class="phpOperator">&gt;</span><span class="phpOperator">=</span> maxH<span class="phpOperator">)</span><span class="phpOperator">{</span>
currH <span class="phpOperator">=</span> maxH<span class="phpText">;</span>
currW <span class="phpOperator">=</span> currH / ratio;
<span class="phpOperator">}</span>
<span class="phpKeyword">
return </span><span class="phpOperator">[</span>currW, currH<span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
</pre>
<p></code></p>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view the code in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=1023&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-resize-image-proportionally-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>How to Add Slideshow to jQuery Lightbox Plugin</title>
		<link>http://www.ajaxblender.com/howto-extend-jquery-lightbox-plugin-with-slideshow.html</link>
		<comments>http://www.ajaxblender.com/howto-extend-jquery-lightbox-plugin-with-slideshow.html#comments</comments>
		<pubDate>Fri, 06 Nov 2009 20:35:10 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[lightbox effect]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=997</guid>
		<description><![CDATA[This tutorial explains how to extend a jQuery Lightbox plugin (by Leandron Vieira Pinho) to have a slideshow.
We previously built a CMS driven website for a client which contains several large photo galleries that use a lightbox effect. Today, the client requested that we add slideshow functionality to the existing plugin to allow automatic switching [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial explains how to extend a <a href="http://leandrovieira.com/projects/jquery/lightbox/" target="_blank">jQuery Lightbox plugin (by Leandron Vieira Pinho)</a> to have a slideshow.<span id="more-997"></span></p>
<p>We previously built a CMS driven website for a client which contains several large photo galleries that use a lightbox effect. Today, the client requested that we add slideshow functionality to the existing plugin to allow automatic switching between photos instead of having visitors click the Next button to view the next item in the gallery.</p>
<p>At first, we suggested to our client to use a different script (a script that already has slideshow features). But since the client needed this “yesterday” :) and he also wants to continue using the current plugin because it’s already proven to work well with his CMS, he asked that we find a way to implement it using the existing plugin. So, in this tutorial we decided to share our experience extending jQuery Lightbox plugin to have basic slideshow functionality.</p>
<p>Okay…we had 10 minutes, we don’t want to disappoint the client, and we have code from a 3rd party plugin that we&#8217;ve never seen before ;). Well, at first our idea was to build our extension on top of the existing code, but the jQuery Lightbox has been created as a single object with private methods which made this idea useless. We had no choice but to make changes to the lightbox.js (sorry Leandron ;)). Here we go.</p>
<p><strong>Step 1. </strong>First, we added two configuration parameters to the lightbox&#8217;s settings:</p>
<pre class="php">
settings <span class="phpOperator">=</span> jQuery<span class="phpOperator">.</span>extend<span class="phpOperator">(</span><span class="phpOperator">{</span>
     <span class="phpComment">// Configuration related to slideshow,
</span>     slideshow<span class="phpOperator">:</span><span class="phpKeyword"> false,</span>
     nextSlideDelay<span class="phpOperator">:</span> 7000,
     <span class="phpOperator">.</span>.<span class="phpOperator">.</span>
</pre>
<p><strong>slideshow</strong> – This sets it to display images in slideshow mode or not. Slideshow functionality is turned off by default, of course.<br />
<strong>nextSlideDelay </strong>– This is a value in milliseconds which sets the period of time for the script to wait before displaying the next image. It is set to 7 seconds, by default.</p>
<p><strong>Step 2. </strong>Next, we make a simple add-on to the <strong>_initialize() </strong>method to start the slideshow if <strong>settings.slideshow</strong> parameter is turned on:</p>
<pre class="php">
<span class="phpFunctionKeyword">function</span> _initialize<span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator">{</span>
    <span class="phpKeyword"> if<span class="phpOperator">(</span></span>settings<span class="phpOperator">.</span>slideshow<span class="phpOperator">)</span><span class="phpOperator">{</span>
         <span class="phpKeyword"> var </span>tmFunc <span class="phpOperator">=</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span> _doSlideShow<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span><span class="phpText">;</span>
          setTimeout<span class="phpOperator">(</span>tmFunc, settings<span class="phpOperator">.</span>nextSlideDelay<span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>
     <span class="phpOperator">.</span>.<span class="phpOperator">.</span>
</pre>
<p><strong>Step 3.</strong> And implementation of the actual _doSlideShow() function which switches to next image:</p>
<pre class="php">
<span class="phpFunctionKeyword">function</span> _doSlideShow<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
     settings<span class="phpOperator">.</span>activeImage<span class="phpOperator"><span class="phpOperator">+</span><span class="phpOperator">+</span></span><span class="phpText">;</span>
    <span class="phpKeyword"> if<span class="phpOperator">(</span></span>settings<span class="phpOperator">.</span>activeImage <span class="phpOperator">&gt;</span><span class="phpOperator">=</span> settings<span class="phpOperator">.</span>imageArray<span class="phpOperator">.</span>length<span class="phpOperator">)</span><span class="phpOperator">{</span>
          settings<span class="phpOperator">.</span>activeImage <span class="phpOperator">=</span> 0;
     <span class="phpOperator">}</span>
     _set_image_to_view<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpKeyword"> var </span>tmFunc <span class="phpOperator">=</span> <span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span> _doSlideShow<span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpOperator">}</span><span class="phpText">;</span>
    <span class="phpKeyword"> if<span class="phpOperator">(</span></span>$<span class="phpOperator">(</span><span class="phpString">'#jquery-lightbox'</span><span class="phpOperator">)</span>.length <span class="phpOperator">&gt;</span> <span class="phpNumber">0</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
          setTimeout<span class="phpOperator">(</span>tmFunc, settings<span class="phpOperator">.</span>nextSlideDelay<span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpOperator">}</span>
<span class="phpOperator">}</span>
</pre>
<p>A few notes about the code:</p>
<p>The lightbox plugin has a variable <strong>settings.activeImage</strong> which points to the visible image from the <strong>settings.imageArray</strong> array. Our function executes every 7 seconds (or any other period of time set via the parameter in the plugin settings), then increases the value of <strong>activeImage </strong>and calls the <strong>_set_image_to_view()</strong> method which displays the current image.</p>
<p>That&#8217;s it ;) Click the <strong>Demo</strong> button to view it in action, or <a href="http://www.ajaxblender.com/article-sources/jquery/lightbox-slideshow-extend/download/lightbox-slideshow.zip">click here</a> to download a patched version of the jQuery Lightbox plugin. It’s a quick mod and saved time for both us and our client. Hopefully, it will save others some time too.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=997&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-extend-jquery-lightbox-plugin-with-slideshow.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Preloader Like at ExtJS.com</title>
		<link>http://www.ajaxblender.com/howto-create-preloader-like-at-extjs-com.html</link>
		<comments>http://www.ajaxblender.com/howto-create-preloader-like-at-extjs-com.html#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:06:46 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Ext.JS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[preloader]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=944</guid>
		<description><![CDATA[The ExtJS 3.0 library is a little large and can require a few seconds to load all the scripts for the page. Therefore the most convenient way address this is to create a preload message which will let your users know that the loading is in process.
Preface
Steps to create the ExtJS preloader:

Create a loading layer, [...]]]></description>
			<content:encoded><![CDATA[<p>The ExtJS 3.0 library is a little large and can require a few seconds to load all the scripts for the page. Therefore the most convenient way address this is to create a preload message which will let your users know that the loading is in process.<span id="more-944"></span></p>
<h3 class="title">Preface</h3>
<p><strong>Steps to create the ExtJS preloader:</strong></p>
<ul>
<li>Create a loading layer, which will contain the progress indicator and display messages while external files (i.e. JavaScript, CSS code, etc.) are loading.</li>
<li>Add a few lines of CSS code to stylize the loading layer.</li>
<li>Add JavaScript code to hide the layer when all external files are loaded.</li>
</ul>
<div class="important-info"><strong>Important!</strong> You should place any CSS code indented for stylizing the loading layer inside of <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag. Place any links to JS, CSS and other files just after your <strong>&lt;body&gt;&#8230;&lt;/body&gt;</strong> tag.</div>
<h3 class="title">Implementation</h3>
<p>Let&#8217;s start from the loading layer. You should create the following HTML code for it:</p>
<pre class="html">
<span class="htmlOtherTag">&lt;body&gt;</span>
     <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;loading-mask&quot;</span>&gt;</span><span class="htmlOtherTag">&lt;/div&gt;</span>
     <span class="htmlOtherTag">&lt;div id=<span class="htmlAttributeValue">&quot;loading&quot;</span>&gt;</span>
          <span class="htmlOtherTag">&lt;span id=<span class="htmlAttributeValue">&quot;loading-message&quot;</span>&gt;</span>Loading. Please wait...<span class="htmlOtherTag">&lt;/span&gt;</span>
     <span class="htmlOtherTag">&lt;/div&gt;</span>
<span class="htmlOtherTag">&lt;/body&gt;</span>
</pre>
<p><strong>&lt;div id=&#8221;loading-mask&#8221;&gt;</strong> will be our overlay layer which will be placed at the top of the page&#8217;s content. We will hide it once the data is fully loaded by the preloader. <strong>&lt;div id=&#8221;loading&#8221;&gt;</strong> is the layer which will be placed at top of &#8220;loading-mask&#8221; and it will be used to display a progress indicator and loading messages.</p>
<p>Use the following CSS code to stylize the content loader. Remember to insert this CSS inside of your <strong>&lt;head&gt;&#8230;&lt;/head&gt;</strong> tag:</p>
<pre class="css">
&lt;style type=<span class="cssString">"text/css"</span>&gt;
<span class="cssSelector">HTML, BODY {</span> <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 100%</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssSelector">#loading-mask {</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> absolute</span><span class="cssRest">;</span>
     <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">left</span><span class="cssRest">:</span><span class="cssValue"> 0</span><span class="cssRest">;</span>
     <span class="cssProperty">width</span><span class="cssRest">:</span><span class="cssValue"> 100%</span><span class="cssRest">;</span>
     <span class="cssProperty">height</span><span class="cssRest">:</span><span class="cssValue"> 100%</span><span class="cssRest">;</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> #000000</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 1</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">#loading {</span>
     <span class="cssProperty">position</span><span class="cssRest">:</span><span class="cssValue"> absolute</span><span class="cssRest">;</span>
     <span class="cssProperty">top</span><span class="cssRest">:</span><span class="cssValue"> 40%</span><span class="cssRest">;</span>
     <span class="cssProperty">left</span><span class="cssRest">:</span><span class="cssValue"> 45%</span><span class="cssRest">;</span>
     <span class="cssProperty">z-index</span><span class="cssRest">:</span><span class="cssValue"> 2</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssSelector">#loading SPAN {</span>
     <span class="cssProperty">background</span><span class="cssRest">:</span><span class="cssValue"> url(<span class="cssString">&#039;/article-sources/images/loader.gif&#039;</span>) no-repeat left center</span><span class="cssRest">;</span>
     <span class="cssProperty">padding</span><span class="cssRest">:</span><span class="cssValue"> 5px 30px</span><span class="cssRest">;</span>
     <span class="cssProperty">display</span><span class="cssRest">:</span><span class="cssValue"> block</span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
&lt;/style&gt;
</pre>
<p>Now, when you have the loading layer, let&#8217;s load two JS files. We will be using a common JavaScript to update the progress messages (preload message) while the data loads.  Remember to insert this code inside of the <strong>&lt;body&gt;&#8230;&lt;/body&gt;</strong> tag, just after the code for loading layer:</p>
<pre class="html">
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span>&gt;</span>
     document.getElementById(&#039;loading-message&#039;).innerHTML = &#039;Loading Core API...&#039;;
<span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;/article-sources/extjs/lib/ext-base.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script&gt;</span>
     document.getElementById(&#039;loading-message&#039;).innerHTML = &#039;Loading ExtJS 3.0 ...&#039;;
<span class="htmlScriptTag">&lt;/script&gt;</span>
<span class="htmlScriptTag">&lt;script type=<span class="htmlAttributeValue">&quot;text/javascript&quot;</span> src=<span class="htmlAttributeValue">&quot;/article-sources/extjs/lib/ext-all.js&quot;</span>&gt;</span><span class="htmlScriptTag">&lt;/script&gt;</span>
</pre>
<p>After this, you use use ExtJS code to fade out the loading message and remove the loading overlay layer from the page:</p>
<pre class="php">
<span class="phpOperator">&lt;</span>script type=<span class="phpString">"text/javascript"</span><span class="phpOperator">&gt;</span>
Ext.onReady<span class="phpOperator">(</span><span class="phpFunctionKeyword">function</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">{</span>
    <span class="phpKeyword"> var </span>loadingMask <span class="phpOperator">=</span> Ext.get<span class="phpOperator">(</span><span class="phpString">'loading-mask'</span><span class="phpOperator">)</span><span class="phpText">;</span>
    <span class="phpKeyword"> var </span>loading <span class="phpOperator">=</span> Ext.get<span class="phpOperator">(</span><span class="phpString">'loading'</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpComment">//  Hide loading message
</span>     loading<span class="phpOperator">.</span>fadeOut<span class="phpOperator">(</span><span class="phpOperator">{</span> duration<span class="phpOperator">:</span> <span class="phpNumber">0</span><span class="phpOperator">.</span><span class="phpNumber">2</span>, remove<span class="phpOperator">:</span><span class="phpKeyword"> true </span><span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
     <span class="phpComment">//  Hide loading mask
</span>     loadingMask<span class="phpOperator">.</span>setOpacity<span class="phpOperator">(</span><span class="phpNumber">0</span><span class="phpOperator">.</span><span class="phpNumber">9</span><span class="phpOperator">)</span><span class="phpText">;</span>
     loadingMask<span class="phpOperator">.</span>shift<span class="phpOperator">(</span><span class="phpOperator">{</span>
          xy<span class="phpOperator">:</span> loading<span class="phpOperator">.</span>getXY<span class="phpOperator">(</span><span class="phpOperator">)</span>,
          width<span class="phpOperator">:</span> loading<span class="phpOperator">.</span>getWidth<span class="phpOperator">(</span><span class="phpOperator">)</span>,
          height<span class="phpOperator">:</span> loading<span class="phpOperator">.</span>getHeight<span class="phpOperator">(</span><span class="phpOperator">)</span>,
          remove<span class="phpOperator">:</span><span class="phpKeyword"> true,</span>
          duration<span class="phpOperator">:</span> <span class="phpNumber">1</span>,
          opacity<span class="phpOperator">:</span> <span class="phpNumber">0</span><span class="phpOperator">.</span><span class="phpNumber">1</span>,
          easing<span class="phpOperator">:</span> <span class="phpString">'bounceOut'</span>
     <span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">&lt;</span>/script<span class="phpOperator">&gt;</span>
</pre>
<p>That&#8217;s it for the ExtJS preloader ;) Click the <strong>View Demo</strong> button to view the code in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=944&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-create-preloader-like-at-extjs-com.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Animations of CSS Properties in jQuery</title>
		<link>http://www.ajaxblender.com/animations-of-css-properties-in-jquery.html</link>
		<comments>http://www.ajaxblender.com/animations-of-css-properties-in-jquery.html#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:40:12 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=891</guid>
		<description><![CDATA[Author of this tutorial illustrateds a basic way to use the jQuery animate() function that allows you to animate easy a property or a group of CSS properties of DOM elements. Demo included.
]]></description>
			<content:encoded><![CDATA[<p>Author of this tutorial illustrateds a basic way to use the jQuery animate() function that allows you to animate easy a property or a group of CSS properties of DOM elements. <em>Demo included.</em></p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=891&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/animations-of-css-properties-in-jquery.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery News Ticker with Tens Lines of Code</title>
		<link>http://www.ajaxblender.com/howto-implement-jquery-news-ticker.html</link>
		<comments>http://www.ajaxblender.com/howto-implement-jquery-news-ticker.html#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:00:41 +0000</pubDate>
		<dc:creator>ajaxBlender.com</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.ajaxblender.com/?p=885</guid>
		<description><![CDATA[From this tutorial you will find out how to create a nice news ticker using jQuery and just 10 lines of JavaScript code. 
Click the &#8220;Demo&#8221; button to see it in action.
]]></description>
			<content:encoded><![CDATA[<p>From this tutorial you will find out how to create a nice news ticker using jQuery and just 10 lines of JavaScript code. <span id="more-885"></span><br />
Click the &#8220;Demo&#8221; button to see it in action.</p>
<img src="http://www.ajaxblender.com/?ak_action=api_record_view&id=885&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.ajaxblender.com/howto-implement-jquery-news-ticker.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

