<?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>Ajax Updates</title>
	<atom:link href="http://www.ajaxupdates.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxupdates.com</link>
	<description>Latest Ajax Scripts, Examples, News and other Ajax related stuff</description>
	<lastBuildDate>Fri, 12 Feb 2010 12:46:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mapbox &#8211; Zoomable jQuery Map Plugin</title>
		<link>http://www.ajaxupdates.com/mapbox-zoomable-jquery-map-plugin/</link>
		<comments>http://www.ajaxupdates.com/mapbox-zoomable-jquery-map-plugin/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 19:50:20 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Jquery Script]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[ajax maps]]></category>
		<category><![CDATA[jquery mapbox]]></category>
		<category><![CDATA[jquery maps]]></category>
		<category><![CDATA[map box]]></category>
		<category><![CDATA[map plugin]]></category>
		<category><![CDATA[mapbox]]></category>
		<category><![CDATA[zoom maps]]></category>
		<category><![CDATA[zoomable map]]></category>
		<category><![CDATA[zoomable mapbox]]></category>
		<category><![CDATA[zoomable maps]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4549</guid>
		<description><![CDATA[The jQuery mapbox() plugin is for creating relatively small scale, zoomable, draggable maps with multiple layers of content. This framework could be applied to games, development plans, or any layout that could benefit from being able to zoom in and pan to get a better view.
The code:
Before using Mapbox, you must link to jQuery and [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-mousewheel-plugin/' rel='bookmark' title='Permanent Link: JQuery Mousewheel Plugin'>JQuery Mousewheel Plugin</a> <small>prototype.js mousewheel Event.wheel(e) extension Scroll mouse wheel to see delta...</small></li><li><a href='http://www.ajaxupdates.com/jparallax-stunning-animation-effects/' rel='bookmark' title='Permanent Link: jParallax &#8211; Stunning Animation Effects'>jParallax &#8211; Stunning Animation Effects</a> <small>jParallax has had a major overhaul in readiness to be...</small></li><li><a href='http://www.ajaxupdates.com/jquery-plugin-tooltip-script/' rel='bookmark' title='Permanent Link: jQuery plugin Tooltip Script'>jQuery plugin Tooltip Script</a> <small>Replacing standard tooltips is easy: Just include the script on...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>The jQuery mapbox() plugin is for creating relatively small scale, zoomable, draggable maps with multiple layers of content. This framework could be applied to games, development plans, or any layout that could benefit from being able to zoom in and pan to get a better view.</p>
<p><strong>The code:</strong><br />
Before using Mapbox, you must link to jQuery and mapbox.js. I do this in the HEAD of my document. I always use the minified jQuery that is hosted by Google. Also, if you want the map&#8217;s zoom to be activated by the mousewheel, you must include the mousewheel plugin: plugins.jquery.com/project/mousewheel</p>
<pre class="brush: javascript">  &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/mousewheel.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/map.js&quot;&gt;&lt;/script&gt;  </pre>
<p>Then, some CSS. This is how I styled the map in this example, though you may use any rules you like (the Middle Earth map has an odd proportion):</p>
<pre class="brush: html">  &lt;style type=&quot;text/css&quot;&gt;
#viewport {
width: 469px;
height: 400px;
cursor: move;
margin: 20px auto;
overflow: hidden; /*keep map contents from spilling over if JS is disabled*/
}
&lt;/style&gt;  </pre>
<p>Then, some HTML. The structure of your map must be almost exactly like this. Every layer DIV must have a height and width set to it. I did it inline in this example only for ease of understanding. IMG tags must be used for every layer except the starting one, which you should notice is structured much differently than the other layers. You currently must include the .mapcontent class on the inner layers, even if you aren&#8217;t planning to add additional content to the map:</p>
<pre class="brush: html">  &lt;div id=&quot;viewport&quot;&gt;
&lt;div style=&quot;background: url(images/layer1.png) no-repeat; width: 469px; height: 400px;&quot;&gt;
&lt;!--top level map content goes here--&gt;
&lt;/div&gt;
&lt;div style=&quot;height: 1097px; width: 1286px;&quot;&gt;
&lt;img src=&quot;images/layer2.jpg&quot; alt=&quot;&quot; /&gt;
&lt;div class=&quot;mapcontent&quot;&gt;
&lt;!--map content goes here--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;height: 1794px; width: 2104px;&quot;&gt;
&lt;img src=&quot;images/layer3.jpg&quot; alt=&quot;&quot; /&gt;
&lt;div class=&quot;mapcontent&quot;&gt;
&lt;!--map content goes here--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;height: 2492px; width: 2922px;&quot;&gt;
&lt;img src=&quot;images/layer4.jpg&quot; alt=&quot;&quot; /&gt;
&lt;div class=&quot;mapcontent&quot;&gt;
&lt;!--map content goes here--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  </pre>
<p><strong>The jQuery: </strong></p>
<pre class="brush: javascript"> &lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&quot;#viewport&quot;).mapbox({mousewheel: true});
});
&lt;/script&gt;   </pre>
<p>That is all! (requires mousewheel plugin: http://plugins.jquery.com/project/mousewheel). If you don&#8217;t require the mousewheel, the map may be created simply as $(&#8220;#viewport&#8221;).map(). Of course, there are some more advanced settings. Here are all of the settings and their defaults:</p>
<pre class="brush: javascript">  &lt;script type=&quot;text/javascript&quot;&gt;
$(&quot;#viewport&quot;).mapbox({
zoom: true,//is the map zoomable?
pan: true,//is the map draggable?
defaultLayer: 0,//this is an array type of number (zero being the first layer), which indicates which layer is shown by default
layerSplit: 4,//this is how many zoom levels each layer has.  The higher this number is, the smoother the transition will be between each layer
mapContent: &quot;.mapcontent&quot;,//this is the class that goes on the layer which holds any content you will manually place onto the map
defaultX: null,//if not set, the map will be centered on the x-axis.  If set, the left side of the map will be here
defaultY: null,//defaultY is the same as defaultX, but for the y-axis
callBefore: function(layer, xcoord, ycoord, viewport) {},//callback which happens when the left mouse button is held down, and gives access to the layer node, the x and y coordinates, and the viewport node.
callAfter: function(layer, xcoord, ycoord, viewport) {},//callback which happens when the left mouse button is released
beforeZoom: function(layer, xcoord, ycoord, viewport) {},//callback which occurs before the map zooms in either direction.
afterZoom: function(layer, xcoord, ycoord, viewport) {},//callback which occurs after the map zooms in either direction.
mousewheel: false //false by default only because it requires mousewheel event plugin: http://plugins.jquery.com/project/mousewheel
}
)
&lt;/script&gt;  </pre>
<p>In addition to the settings, there are some methods that may be passed to any map once it has been created:</p>
<pre class="brush: javascript"> &lt;script type=&quot;text/javascript&quot;&gt;
$(&quot;#viewport&quot;).mapbox(&quot;zoom&quot;);//zooms in 1 level (determined by layerSplit option)
$(&quot;#viewport&quot;).mapbox(&quot;zoom&quot;, 2);//zooms in 2 levels
$(&quot;#viewport&quot;).mapbox(&quot;back&quot;);//zooms out 1 level
$(&quot;#viewport&quot;).mapbox(&quot;back&quot;, 2);//zooms out 2 levels
$(&quot;#viewport&quot;).mapbox(&quot;zoomTo&quot;, 2);//zooms to the default size of the third layer (0 being the first)
$(&quot;#viewport&quot;).mapbox(&quot;left&quot;);//move the current layer left 10 pixels
$(&quot;#viewport&quot;).mapbox(&quot;right&quot;);//move the current layer right 10 pixels
$(&quot;#viewport&quot;).mapbox(&quot;up&quot;);//move the current layer up 10 pixels
$(&quot;#viewport&quot;).mapbox(&quot;down&quot;);//move the current layer down 10 pixels
$(&quot;#viewport&quot;).mapbox(&quot;left&quot;, 20);//move the current layer left 20 pixels
$(&quot;#viewport&quot;).mapbox(&quot;right&quot;, 20);//move the current layer right 20 pixels
$(&quot;#viewport&quot;).mapbox(&quot;up&quot;, 20);//move the current layer up 20 pixels
$(&quot;#viewport&quot;).mapbox(&quot;down&quot;, 20);//move the current layer down 20 pixels
$(&quot;#viewport&quot;).mapbox(&quot;center&quot;);//centers current layer
$(&quot;#viewport&quot;).mapbox(&quot;center&quot;, {
x: 200,
y: 400
});//centers current layer at positions 200px, 400px on the x and y axis
&lt;/script&gt;   </pre>
<p>Here&#8217;s an example using some of these methods to implement a control panel for the map:</p>
<pre class="brush: javascript">  jQuery(document).ready(function() {
$(&quot;#viewport2&quot;).mapbox({
mousewheel: true,
layerSplit: 8//smoother transition for mousewheel
});
jQuery(&quot;.map-control a&quot;).click(function() {//control panel
var viewport = $(&quot;#viewport2&quot;);
//this.className is same as method to be called
if(this.className == &quot;zoom&quot; || this.className == &quot;back&quot;) {
viewport.mapbox(this.className, 2);//step twice
}
else {
viewport.mapbox(this.className);
}
return false;
});
})   </pre>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/61">http://dllurl.com/61</a><br />
Download: <a href="http://dllurl.com/62">http://dllurl.com/62</a><br />
Source:  <a href="http://dllurl.com/61">http://dllurl.com/61</a></p>
<p>Additional Resource :  <a href="http://www.asbestosandmesotheliomacancer.com/" target="_self">Asbestos and Mesothelioma Cancer</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fmapbox-zoomable-jquery-map-plugin%2F', 'Mapbox+%26%238211%3B+Zoomable+jQuery+Map+Plugin')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fmapbox-zoomable-jquery-map-plugin%2F', title: '+Mapbox+%26%238211%3B+Zoomable+jQuery+Map+Plugin+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-mousewheel-plugin/' rel='bookmark' title='Permanent Link: JQuery Mousewheel Plugin'>JQuery Mousewheel Plugin</a> <small>prototype.js mousewheel Event.wheel(e) extension Scroll mouse wheel to see delta...</small></li><li><a href='http://www.ajaxupdates.com/jparallax-stunning-animation-effects/' rel='bookmark' title='Permanent Link: jParallax &#8211; Stunning Animation Effects'>jParallax &#8211; Stunning Animation Effects</a> <small>jParallax has had a major overhaul in readiness to be...</small></li><li><a href='http://www.ajaxupdates.com/jquery-plugin-tooltip-script/' rel='bookmark' title='Permanent Link: jQuery plugin Tooltip Script'>jQuery plugin Tooltip Script</a> <small>Replacing standard tooltips is easy: Just include the script on...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/mapbox-zoomable-jquery-map-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autosave &#8211; Flexible Jquery Plugin</title>
		<link>http://www.ajaxupdates.com/autosave-flexible-jquery-plugin/</link>
		<comments>http://www.ajaxupdates.com/autosave-flexible-jquery-plugin/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 19:35:45 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Jquery Script]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Autosave]]></category>
		<category><![CDATA[flexible autosave]]></category>
		<category><![CDATA[jauto]]></category>
		<category><![CDATA[jautosave]]></category>
		<category><![CDATA[jquery autosave]]></category>
		<category><![CDATA[jquery autosave plugin]]></category>
		<category><![CDATA[jsave]]></category>
		<category><![CDATA[simple autosave]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4546</guid>
		<description><![CDATA[Autosave is a flexible autosave plugin for jQuery. If yo want to autosave a form use this simple code.
Features
    * Send entire form when one element changes
    * Send just the changed element
    * Form buttons and input:submit is not sent unless clicked
    [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-plugin-autosave/' rel='bookmark' title='Permanent Link: jQuery Plugin &#8211; autoSave'>jQuery Plugin &#8211; autoSave</a> <small>autoSave is the result of one too many user complaints...</small></li><li><a href='http://www.ajaxupdates.com/animated-ajax-delete-jquery/' rel='bookmark' title='Permanent Link: Animated Ajax Delete : jQuery'>Animated Ajax Delete : jQuery</a> <small>I’m a huge fan of WordPress’ method of individual article...</small></li><li><a href='http://www.ajaxupdates.com/autopopulating-select-boxes/' rel='bookmark' title='Permanent Link: Autopopulating Select Boxes'>Autopopulating Select Boxes</a> <small>Allow the user to select a top level category from...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Autosave is a flexible autosave plugin for jQuery. If yo want to autosave a form use this simple code.</p>
<p><strong>Features</strong></p>
<p>    * Send entire form when one element changes<br />
    * Send just the changed element<br />
    * Form buttons and input:submit is not sent unless clicked<br />
    * Override action/method parameter of form or fallback<br />
    * Send elements from multiple forms in one request<br />
    * Callbacks on sending, success and error<br />
<strong>Usage: </strong></p>
<pre class="brush: javascript">
$(&quot;input.autosave&quot;).autosave({
    url: url, // Defaults to parent form url or window.location.href
    method: &quot;post&quot;,  // Defaults to parent form url or get
    grouped: true, // Defaults to false. States whether all &quot;input.autosave&quot; should be sent in the request or only the
    one it was triggered upon
    success: function(data) {
        console.log(data);
    },
    dataType: &quot;json&quot;, // Defaults to JSON, but can be XML, HTML and so on
    send: function() {
        // Do stuff while we wait for the ajax response, defaults to doing nothing
        console.log(&quot;Saving&quot;);
    },
    error: function(xmlReq, text, errorThrown) {
        // Handler if the ajax request fails, defaults to console.log-ing the ajax request scope
        console.log(text);
    }
});
// Submits entire form each time one of the
// elements are changed
$(&quot;form#myForm&quot;).autosave();
 </pre>
<p><strong>Todo:</strong><br />
Support timed autosave for textareas</p>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/60">http://dllurl.com/60</a><br />
Download: <a href="http://dllurl.com/59">http://dllurl.com/59</a><br />
Source: <a href="http://dllurl.com/60">http://dllurl.com/60</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fautosave-flexible-jquery-plugin%2F', 'Autosave+%26%238211%3B+Flexible+Jquery+Plugin')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fautosave-flexible-jquery-plugin%2F', title: '+Autosave+%26%238211%3B+Flexible+Jquery+Plugin+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-plugin-autosave/' rel='bookmark' title='Permanent Link: jQuery Plugin &#8211; autoSave'>jQuery Plugin &#8211; autoSave</a> <small>autoSave is the result of one too many user complaints...</small></li><li><a href='http://www.ajaxupdates.com/animated-ajax-delete-jquery/' rel='bookmark' title='Permanent Link: Animated Ajax Delete : jQuery'>Animated Ajax Delete : jQuery</a> <small>I’m a huge fan of WordPress’ method of individual article...</small></li><li><a href='http://www.ajaxupdates.com/autopopulating-select-boxes/' rel='bookmark' title='Permanent Link: Autopopulating Select Boxes'>Autopopulating Select Boxes</a> <small>Allow the user to select a top level category from...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/autosave-flexible-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CJ Image Video Previewer</title>
		<link>http://www.ajaxupdates.com/cj-image-video-previewer/</link>
		<comments>http://www.ajaxupdates.com/cj-image-video-previewer/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 16:05:20 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Image Scripts]]></category>
		<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[ajax preview]]></category>
		<category><![CDATA[cj image]]></category>
		<category><![CDATA[CJ Image Video Previewer]]></category>
		<category><![CDATA[cj video previewer]]></category>
		<category><![CDATA[image preview]]></category>
		<category><![CDATA[mimic video]]></category>
		<category><![CDATA[previewer script]]></category>
		<category><![CDATA[video preview]]></category>
		<category><![CDATA[video previewer scrip]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4544</guid>
		<description><![CDATA[CJ Image Video Previewer is meant to mimic the video preview boxes you see on many Video sites. It displays a block that contains an image thumbnail and when the user moves their cursor of the box, it dynamically loads and then displays a group of images in sequence. Kind of like a flip-book. This [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/swf-video-player-script/' rel='bookmark' title='Permanent Link: SWF Video Player Script'>SWF Video Player Script</a> <small>This new component will give your viewers the ability to...</small></li><li><a href='http://www.ajaxupdates.com/javascript-wait-while-loading-page-display-image/' rel='bookmark' title='Permanent Link: Javascript Wait While Loading Page Display Image'>Javascript Wait While Loading Page Display Image</a> <small> If you have a page that takes long time...</small></li><li><a href='http://www.ajaxupdates.com/image-watermark-on-uploaded-images/' rel='bookmark' title='Permanent Link: Image Watermark on Uploaded Images'>Image Watermark on Uploaded Images</a> <small>This tutorial shows you how you can add a watermark...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>CJ Image Video Previewer is meant to mimic the video preview boxes you see on many Video sites. It displays a block that contains an image thumbnail and when the user moves their cursor of the box, it dynamically loads and then displays a group of images in sequence. Kind of like a flip-book. This is an excellent way to provide an preview of the video, without the user actually downloading the video file.</p>
<p>The plugin has a few options you can pass to it. You can set the delay amount and determine if you want to show the &#8220;image loading&#8221; progress bar. I&#8217;m currently in the middle of re-writing my blog site, so I&#8217;m not going to bother posting detailed instructions just yet. Just take a look at the demo source. I&#8217;ve provided three different examples that should help you figure things out. If not, give me a shout out below. Enjoy!<br />
<!--adsense--><br />
Demo: <a href="http://dllurl.com/54">http://dllurl.com/54</a><br />
Download: <a href="http://dllurl.com/52">http://dllurl.com/52</a><br />
Source: <a href="http://dllurl.com/53">http://dllurl.com/53</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fcj-image-video-previewer%2F', 'CJ+Image+Video+Previewer')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fcj-image-video-previewer%2F', title: '+CJ+Image+Video+Previewer+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/swf-video-player-script/' rel='bookmark' title='Permanent Link: SWF Video Player Script'>SWF Video Player Script</a> <small>This new component will give your viewers the ability to...</small></li><li><a href='http://www.ajaxupdates.com/javascript-wait-while-loading-page-display-image/' rel='bookmark' title='Permanent Link: Javascript Wait While Loading Page Display Image'>Javascript Wait While Loading Page Display Image</a> <small> If you have a page that takes long time...</small></li><li><a href='http://www.ajaxupdates.com/image-watermark-on-uploaded-images/' rel='bookmark' title='Permanent Link: Image Watermark on Uploaded Images'>Image Watermark on Uploaded Images</a> <small>This tutorial shows you how you can add a watermark...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/cj-image-video-previewer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Before-After Plugin</title>
		<link>http://www.ajaxupdates.com/jquery-before-after-plugin/</link>
		<comments>http://www.ajaxupdates.com/jquery-before-after-plugin/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 15:19:16 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Image Scripts]]></category>
		<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Jquery Script]]></category>
		<category><![CDATA[after plugin]]></category>
		<category><![CDATA[ajax images]]></category>
		<category><![CDATA[before plugin]]></category>
		<category><![CDATA[image plugin]]></category>
		<category><![CDATA[jimage]]></category>
		<category><![CDATA[jquery after before]]></category>
		<category><![CDATA[jquery before after]]></category>
		<category><![CDATA[jquery image]]></category>
		<category><![CDATA[jquery image effects]]></category>
		<category><![CDATA[jquery image plugin]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4542</guid>
		<description><![CDATA[To show the difference  in the reconstruction project, they showed a before and after picture using Flash that let the visitor drag a slider over the images, which were sandwiched with one on top of the other, so that you could easily see how dramatic the changes were. I immediately thought that this could [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/password-strength-estimates-brute-force-time-jquery-plugin/' rel='bookmark' title='Permanent Link: Password Strength &#8211; Estimates brute force time jQuery plugin'>Password Strength &#8211; Estimates brute force time jQuery plugin</a> <small>This plugin shows the strength of you passwords by telling...</small></li><li><a href='http://www.ajaxupdates.com/imgareaselect-with-jquery-plugin/' rel='bookmark' title='Permanent Link: imgAreaSelect with jQuery Plugin'>imgAreaSelect with jQuery Plugin</a> <small>imgAreaSelect is a jQuery plugin for selecting a rectangular area...</small></li><li><a href='http://www.ajaxupdates.com/jquery-lightbox-plugin/' rel='bookmark' title='Permanent Link: jQuery Lightbox Plugin'>jQuery Lightbox Plugin</a> <small>jQuery lightBox plugin is simple, elegant, unobtrusive, no need extra...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>To show the difference  in the reconstruction project, they showed a before and after picture using Flash that let the visitor drag a slider over the images, which were sandwiched with one on top of the other, so that you could easily see how dramatic the changes were. I immediately thought that this could be done in JavaScript using jQuery, so I set out to do it. Here’s the result:</p>
<p><img src="http://www.catchmyfame.com/jquery/conan_bef_sm.jpg" alt="" /></p>
<p>Pretty slick no? The possibilities for this plugin are endless. Doctors can have before and after images of patients, Photoshop users can show the before and after differences between images, remodelers can show the before and after images of projects and on and on. This plugin weighs in at only 7K and can be used multiple times on a page.<br />
<strongfeatures </strong></p>
<p>    * Slick effect, no Flash needed<br />
    * It’s just 7K<br />
    * Reusable on multiple containers<br />
    * Degradable. If the visitor doesn’t have JavaScript they will still see both images.</p>
<p><strong>How to Use</strong></p>
<p>First, your before and after images must be the same size.  Each image must be inside its own div, and both of those within a containing div which must have an ID.  See this example.</p>
<pre class="brush: html">   &lt;div id=&quot;container&quot;&gt;
 &lt;div&gt;&lt;img alt=&quot;before&quot; src=&quot;before.jpg&quot; width=&quot;600&quot; height=&quot;366&quot; /&gt;&lt;/div&gt;
 &lt;div&gt;&lt;img alt=&quot;after&quot; src=&quot;after.jpg&quot; width=&quot;600&quot; height=&quot;366&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>All images *MUST* have the width and height declared otherwise the plugin won’t work in Safari, Chrome, and any other webkit-based browsers.</p>
<p>To use the plugin you’ll need to have a copy of  jQuery and the jQuery UI, or point to jquery on Google and jqueryui on Google, and the plugin. Place the files on your site and link to them:</p>
<pre class="brush: javascript">   &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.beforeafter.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
	$(&#039;#container&#039;).beforeAfter();
});
&lt;/script&gt;</pre>
<p>That’s it! You can apply the before/after plugin to any number of elements on a page.<br />
Options</p>
<p>The following options are configurable:</p>
<p>    * animateIntro  – whether or not to have the drag bar start completely to the right of the container and gradually move by itself to the midpoint (default  false)<br />
    * introDelay – if animateIntro is true, the number of milliseconds to wait before beginning the automatic drag bar move to the center of the image (default  1000)<br />
    * introDuration – if animateIntro is true, the number of milliseconds it will take for the drag bar to go from the right side of the image to the middle of the image (default 1000)<br />
    * showFullLinks – whether or not to display links below the image that a visitor can click on that will automatically show the full before or full after image (default true)</p>
<p>Options are added when calling the script:</p>
<pre class="brush: javascript"> $(&#039;#container&#039;).beforeAfter({
	animateIntro : true,
        introDelay : 2000,
        introDuration : 500,
        showFullLinks : false
});  </pre>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/50">http://dllurl.com/50</a><br />
Download: <a href="http://dllurl.com/51">http://dllurl.com/51</a><br />
Source: <a href="http://dllurl.com/50">http://dllurl.com/50</a></strongfeatures></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjquery-before-after-plugin%2F', 'jQuery+Before-After+Plugin')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjquery-before-after-plugin%2F', title: '+jQuery+Before-After+Plugin+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/password-strength-estimates-brute-force-time-jquery-plugin/' rel='bookmark' title='Permanent Link: Password Strength &#8211; Estimates brute force time jQuery plugin'>Password Strength &#8211; Estimates brute force time jQuery plugin</a> <small>This plugin shows the strength of you passwords by telling...</small></li><li><a href='http://www.ajaxupdates.com/imgareaselect-with-jquery-plugin/' rel='bookmark' title='Permanent Link: imgAreaSelect with jQuery Plugin'>imgAreaSelect with jQuery Plugin</a> <small>imgAreaSelect is a jQuery plugin for selecting a rectangular area...</small></li><li><a href='http://www.ajaxupdates.com/jquery-lightbox-plugin/' rel='bookmark' title='Permanent Link: jQuery Lightbox Plugin'>jQuery Lightbox Plugin</a> <small>jQuery lightBox plugin is simple, elegant, unobtrusive, no need extra...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/jquery-before-after-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Image Watermark on Uploaded Images</title>
		<link>http://www.ajaxupdates.com/image-watermark-on-uploaded-images/</link>
		<comments>http://www.ajaxupdates.com/image-watermark-on-uploaded-images/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 21:20:40 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Image Scripts]]></category>
		<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[ajax watermark]]></category>
		<category><![CDATA[how to watermark]]></category>
		<category><![CDATA[image watermark]]></category>
		<category><![CDATA[javascript watermark]]></category>
		<category><![CDATA[uploaded image watermark]]></category>
		<category><![CDATA[watermark]]></category>
		<category><![CDATA[watermark script]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4540</guid>
		<description><![CDATA[This tutorial shows you how you can add a watermark image over images that are uploaded though a form. 
The following is a html code as simple as it can be with an image type input and a Submit button:
 &#60;form name=&#34;submit_image&#34; method=&#34;post&#34; enctype=&#34;multipart/form-data&#34;  action=&#34;&#34;&#62;

&#60;input type=&#34;file&#34; name=&#34;image&#34;/&#62;
&#60;input name=&#34;Submit&#34; type=&#34;submit&#34; value=&#34;Upload Picture&#34;/&#62;

&#60;/form&#62;  
This is [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/dhtml-api-drag-drop-for-images-and-layers-ajax-javascript/' rel='bookmark' title='Permanent Link: DHTML API, Drag &#038; Drop for Images and Layers &#8211; Ajax &#8211; Javascript'>DHTML API, Drag &#038; Drop for Images and Layers &#8211; Ajax &#8211; Javascript</a> <small>A Cross-browser JavaScript DHTML Library which adds Drag Drop functionality...</small></li><li><a href='http://www.ajaxupdates.com/moo-flow-images-gallery/' rel='bookmark' title='Permanent Link: Moo Flow Images Gallery'>Moo Flow Images Gallery</a> <small>MooFlow is a Gallery that looks like Apple&#8217;s iTunes or...</small></li><li><a href='http://www.ajaxupdates.com/scripts-for-annotating-images/' rel='bookmark' title='Permanent Link: Scripts for annotating images'>Scripts for annotating images</a> <small>FotonotesTM is an standard, specification, and collection of scripts for...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>This tutorial shows you how you can add a watermark image over images that are uploaded though a form. </p>
<p>The following is a html code as simple as it can be with an image type input and a Submit button:</p>
<pre class="brush: html"> &lt;form name=&quot;submit_image&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;  action=&quot;&quot;&gt;

&lt;input type=&quot;file&quot; name=&quot;image&quot;/&gt;
&lt;input name=&quot;Submit&quot; type=&quot;submit&quot; value=&quot;Upload Picture&quot;/&gt;

&lt;/form&gt;  </pre>
<p>This is the function that applies the watermark over the uploaded picture and uploads the picture on the server. It considers that the location where the images are to be uploaded is a folder named &#8220;images&#8221;:</p>
<pre class="brush: javascript"> function copy_marked($img_name,$newname,$type)
{
// check image type. The image type is sent as parameter 3 ($type). Note that for every image type a different function is used to create an image in memory from the uploaded file.

   if(!strcmp(&quot;image/jpg&quot;,$type) || !strcmp(&quot;image/jpeg&quot;,$type) || !strcmp(&quot;image/pjpeg&quot;,$type))
        $src_img=imagecreatefromjpeg($img_name);

    if(!strcmp(&quot;image/png&quot;,$type))
        $src_img=imagecreatefrompng($img_name);

    if(!strcmp(&quot;image/gif&quot;,$type))
        $src_img=imagecreatefromgif($img_name);

// get image size, we&#039;ll need it later
    $old_x=imageSX($src_img);
    $old_y=imageSY($src_img);

// create destination image
    $dst_img=ImageCreateTrueColor($old_x,$old_y);

    imagecopyresampled($dst_img,$src_img,0,0,0,0,$old_x,$old_y,$old_x,$old_y);

    // on this demo, the watermark image will be named watermark.gif and will be located in images folder. If you intend to use other file, you will have to change this
    $watermark_file=&#039;images/watermark.gif&#039;;

// you can setup the transparency used for watermark image.
   $transparency=50;

// just in case you don&#039;t know what extension the watermark file has. This function is listed lower
   $wext=getFileExtension(&#039;images/watermark.gif&#039;);

// create an image from watermark file
    if(!strcmp(&quot;jpg&quot;,$wext) || !strcmp(&quot;jpeg&quot;,$wext)) $watermark=imagecreatefromjpeg($watermark_file);

    if(!strcmp(&quot;png&quot;,$wext)) $watermark=imagecreatefrompng($watermark_file);

    if(!strcmp(&quot;gif&quot;,$wext)) $watermark=imagecreatefromgif($watermark_file);

// get watermark width
    $watermark_width = imagesx($watermark);
    $watermark_height = imagesy($watermark);

// place watermark image on the right left of the main image
    $dest_x = $old_x - $watermark_width - 5;
    $dest_y = $old_y - $watermark_height - 5;

 // uncomment these lines and comment the ones above if you want to place the watermark in the very center of the image
//    $dest_x = (($thumb_w - $watermark_width)/2);
//    $dest_y = (($thumb_h - $watermark_height)/2);

// merge the two images
  imagecopymerge($dst_img, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $transparency);

 // copy the new created image to the destination file, in the images folder
   if(!strcmp(&quot;image/png&quot;,$type))  imagepng($dst_img,$newname);

    else if(!strcmp(&quot;image/gif&quot;,$type))  imagegif($dst_img,$newname);

    else imagejpeg($dst_img,$newname);

// delete the images from memory
   imagedestroy($dst_img);
    imagedestroy($src_img);

}  </pre>
<p> Function getFileExtension(), needed to get the file extension:</p>
<pre class="brush: javascript"> function getFileExtension($str) {
        $i = strrpos($str,&quot;.&quot;);
        if (!$i) { return &quot;&quot;; }
        $l = strlen($str) - $i;
        $ext = substr($str,$i+1,$l);
        return $ext;
}  </pre>
<p>Having all these functions, here is how you verify if the form was submitted and call the copy_marked() function to upload the file and place the watermark:</p>
<pre class="brush: javascript">  if($_SERVER[&#039;REQUEST_METHOD&#039;]==&#039;POST&#039;)
{
    if ($_FILES[&#039;image&#039;][&#039;name&#039;])
    {
        $image=$_FILES[&#039;image&#039;][&#039;name&#039;];
         $newname=&quot;images/&quot;.$image;
        copy_marked($_FILES[&#039;image&#039;][&#039;tmp_name&#039;],$newname,$_FILES[&#039;image&#039;][&#039;type&#039;]);
    }
} </pre>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/48">http://dllurl.com/48</a><br />
Source: <a href="http://dllurl.com/49">http://dllurl.com/49</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fimage-watermark-on-uploaded-images%2F', 'Image+Watermark+on+Uploaded+Images')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fimage-watermark-on-uploaded-images%2F', title: '+Image+Watermark+on+Uploaded+Images+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/dhtml-api-drag-drop-for-images-and-layers-ajax-javascript/' rel='bookmark' title='Permanent Link: DHTML API, Drag &#038; Drop for Images and Layers &#8211; Ajax &#8211; Javascript'>DHTML API, Drag &#038; Drop for Images and Layers &#8211; Ajax &#8211; Javascript</a> <small>A Cross-browser JavaScript DHTML Library which adds Drag Drop functionality...</small></li><li><a href='http://www.ajaxupdates.com/moo-flow-images-gallery/' rel='bookmark' title='Permanent Link: Moo Flow Images Gallery'>Moo Flow Images Gallery</a> <small>MooFlow is a Gallery that looks like Apple&#8217;s iTunes or...</small></li><li><a href='http://www.ajaxupdates.com/scripts-for-annotating-images/' rel='bookmark' title='Permanent Link: Scripts for annotating images'>Scripts for annotating images</a> <small>FotonotesTM is an standard, specification, and collection of scripts for...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/image-watermark-on-uploaded-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Wait While Loading Page Display Image</title>
		<link>http://www.ajaxupdates.com/javascript-wait-while-loading-page-display-image/</link>
		<comments>http://www.ajaxupdates.com/javascript-wait-while-loading-page-display-image/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 21:00:55 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Javascript]]></category>
		<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[ajax wait]]></category>
		<category><![CDATA[image wait]]></category>
		<category><![CDATA[java wait]]></category>
		<category><![CDATA[javascript wait]]></category>
		<category><![CDATA[Loading Image]]></category>
		<category><![CDATA[loading wait]]></category>
		<category><![CDATA[page display wait]]></category>
		<category><![CDATA[page laoding wait]]></category>
		<category><![CDATA[page wait]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4537</guid>
		<description><![CDATA[ If you have a page that takes long time to display it is a good idea to display a &#8220;wait until the page loads&#8221; image. This tutorial show you how to implement this in your webpage.
To implement this you will need to:
1. Every time your page loads a &#8220;init()&#8221; function will load.
  &#60;body [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/cj-image-video-previewer/' rel='bookmark' title='Permanent Link: CJ Image Video Previewer'>CJ Image Video Previewer</a> <small>CJ Image Video Previewer is meant to mimic the video...</small></li><li><a href='http://www.ajaxupdates.com/javascript-image-combobox-v15/' rel='bookmark' title='Permanent Link: JavaScript image combobox v1.5'>JavaScript image combobox v1.5</a> <small>Are you tired with your old fashion dropdown? Try this...</small></li><li><a href='http://www.ajaxupdates.com/loading-panel-widget/' rel='bookmark' title='Permanent Link: Loading Panel Widget'>Loading Panel Widget</a> <small>Probably needless to say, but here it is. A web...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p> If you have a page that takes long time to display it is a good idea to display a &#8220;wait until the page loads&#8221; image. This tutorial show you how to implement this in your webpage.</p>
<p>To implement this you will need to:</p>
<p>1. Every time your page loads a &#8220;init()&#8221; function will load.</p>
<pre class="brush: javascript">  &lt;body onLoad=&quot;init()&quot;&gt; </pre>
<p>2. Define a div named &#8220;loading&#8221; right after < body > section.</p>
<pre class="brush: html"> &lt;div id=&quot;loading&quot; style=&quot;position:absolute; width:100%; text-align:center; top:300px;&quot;&gt;
&lt;img src=&quot;loading.gif&quot; border=0/&gt;&lt;/div&gt;  </pre>
<p>The loading.gif image should be an animated gif that suggests that the page is still loading.</p>
<p>3. Place this javascript code right after you define the div.</p>
<pre class="brush: javascript"> &lt;script&gt;
 var ld=(document.all);
  var ns4=document.layers;
 var ns6=document.getElementById&amp;amp;&amp;amp;!document.all;
 var ie4=document.all;
  if (ns4)
 	ld=document.loading;
 else if (ns6)
 	ld=document.getElementById(&quot;loading&quot;).style;
 else if (ie4)
 	ld=document.all.loading.style;
  function init()
 {
 if(ns4){ld.visibility=&quot;hidden&quot;;}
 else if (ns6||ie4) ld.display=&quot;none&quot;;
 }
 &lt;/script&gt;  </pre>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/46">http://dllurl.com/46</a><br />
Source: <a href="http://dllurl.com/47">http://dllurl.com/47</a></body></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjavascript-wait-while-loading-page-display-image%2F', 'Javascript+Wait+While+Loading+Page+Display+Image')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjavascript-wait-while-loading-page-display-image%2F', title: '+Javascript+Wait+While+Loading+Page+Display+Image+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/cj-image-video-previewer/' rel='bookmark' title='Permanent Link: CJ Image Video Previewer'>CJ Image Video Previewer</a> <small>CJ Image Video Previewer is meant to mimic the video...</small></li><li><a href='http://www.ajaxupdates.com/javascript-image-combobox-v15/' rel='bookmark' title='Permanent Link: JavaScript image combobox v1.5'>JavaScript image combobox v1.5</a> <small>Are you tired with your old fashion dropdown? Try this...</small></li><li><a href='http://www.ajaxupdates.com/loading-panel-widget/' rel='bookmark' title='Permanent Link: Loading Panel Widget'>Loading Panel Widget</a> <small>Probably needless to say, but here it is. A web...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/javascript-wait-while-loading-page-display-image/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mod Rewrite for Subdomains</title>
		<link>http://www.ajaxupdates.com/mod-rewrite-for-subdomains/</link>
		<comments>http://www.ajaxupdates.com/mod-rewrite-for-subdomains/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 20:57:44 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[mod rewire]]></category>
		<category><![CDATA[mod rewrite]]></category>
		<category><![CDATA[mod-rewireter]]></category>
		<category><![CDATA[modrewrite]]></category>
		<category><![CDATA[rewirter for subdomains]]></category>
		<category><![CDATA[subdomain mod rewrite]]></category>
		<category><![CDATA[subdomain rewire]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4534</guid>
		<description><![CDATA[You might have noticed some sites having their URLs written as if they were different subdomains of the same domain. For example, for a news site that has the dynamic links of the following form:

http://yournewsdomain.com?topic=it 	-  link that goes to IT news page

http://yournewsdomain.com?topic=business 	- link that goes to business news page

To be rewritten in [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/codeigniter-open-source-php-web-application-framework/' rel='bookmark' title='Permanent Link: CodeIgniter &#8211; Open source PHP web application framework'>CodeIgniter &#8211; Open source PHP web application framework</a> <small>CodeIgniter is a powerful PHP framework with a very small...</small></li><li><a href='http://www.ajaxupdates.com/template-elements-css-framework/' rel='bookmark' title='Permanent Link: Template Elements &#8211; CSS Framework'>Template Elements &#8211; CSS Framework</a> <small>Elements is a down to earth CSS framework. It was...</small></li><li><a href='http://www.ajaxupdates.com/record-mouse-movement/' rel='bookmark' title='Permanent Link: Record Mouse Movement'>Record Mouse Movement</a> <small>The “movelogger” records the mouse movement a users does on...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>You might have noticed some sites having their URLs written as if they were different subdomains of the same domain. For example, for a news site that has the dynamic links of the following form:</p>
<blockquote>
<pre>http://yournewsdomain.com?topic=it 	<em>-  link that goes to IT news page</em>

http://yournewsdomain.com?topic=business 	<em>- link that goes to business news page</em></pre>
</blockquote>
<p>To be rewritten in this form:</p>
<blockquote>
<pre>http://it.yournewsdomain.com

http://business.yournewsdomain.com</pre>
</blockquote>
<p>You can achieve this without actually creating the subdomains on your server. This can be done with Apache <strong><em>mod_rewrite</em></strong>.</p>
<p>For this method to work you need a server that runs <em>Apache</em> and has <em>mod_rewrite</em> module installed. Also, if you don&#8217;t have access to server configuration files, then you might need some help from your hosting support for the second step and possibly with the fists step of this tutorial.</p>
<p><strong>Step 1.</strong> <span style="text-decoration: underline;">Create a <strong>wildcard DNS</strong> A record in your DNS Zone.</span></p>
<p>A wildcard DNS record is a record reprezented by the character &#8220;*&#8221; , that will match all non existing subdomain names. For example <strong><em>*.yournewsdomain.com</em></strong> will match for  <strong><em>key1.yournewsdomain.com</em></strong> , <strong><em>key2.yournewsdomain.com</em></strong> and so on.</p>
<p>You will need to edit the DNS zone records for your domain and add an A record for *.yournewsdomain.com. , pointing to the IP for your domain.</p>
<p>If your domain  is on a shared hosting account, then you will need to search in your control panel for a section for DNS management. Enter a new A type DNS record, set as name &#8220;*&#8221; and enter the IP for your domain. If you cannot find a DNS management section on your hosting account, then you will have to ask your hosting support to add it for you.</p>
<p><strong>Step 2.</strong> <span style="text-decoration: underline;">Setup wildcard <strong><em>ServerAlias</em></strong></span></p>
<p>You must now configure Apache server to serve the pages that come for any subdomain of your domain. Do this by adding a wildcard <strong><em>ServerAlias</em></strong>.</p>
<p>Add the following line to httpd.conf <strong><em>VirtualHosts</em></strong> section for your domain:</p>
<pre>ServerAlias www.yournewsdomain.com yournewsdomain.com *.yournewsdomain.com</pre>
<p>Again, if you are on a shared hosting and don&#8217;t have access to <strong><em>httpd.conf</em></strong> file, and no means in your control panel to edit your <strong><em>VirtualHosts</em></strong> section, then you must  ask help from your hosting support.</p>
<p><strong>Step 3.</strong> <span style="text-decoration: underline;">Add rewrite rules to your <em><strong>.htaccess</strong></em> file</span></p>
<p>First you must prepare your <strong><em>.htaccess</em></strong> file . If the file does not exist, create it.</p>
<p>You might already have these lines in your <strong><em>.htaccess</em></strong> files, if you do don&#8217;t add them again.</p>
<pre>Options +FollowSymLinks</pre>
<p>You need this option enabled for your rewrite rules to work. But in most cases is already enabled in the configuration files for the http server.</p>
<pre>RewriteEngine On</pre>
<p>Use this line if <em><strong>RewriteEngine</strong></em> is not already enabled on your server.</p>
<pre>RewriteBase /</pre>
<p>If your code is in the root of your domain, then use / as the rewrite base, like in the line above. If it is in a folder, then use the path to that folder, for example:</p>
<pre>RewriteBase /subdomain/</pre>
<p>Add the actual rewrite rules:</p>
<blockquote>
<pre>RewriteCond %{HTTP_HOST} !www.yournewsdomain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).yournewsdomain.com [NC]
RewriteRule (.*) index.php?topic=%2 [NC,QSA]</pre>
</blockquote>
<p>First 2 lines add the condition for the actual rewrite rule (line 3) to come in place.</p>
<p>First line will add an exception for the subdomain www. Add here a similar line for each subdomain that you don&#8217;t want to follow the same rule.</p>
<p>Second line adds the condition that the URL is in a form that looks like a subdomain , with or without the www string in front (<em>http://anything.yournewsdomain.com</em>).</p>
<p>The actual rule is the third line, and will translate any URL that matches the above conditions to a form: http://yournewsdomain.com?topic=%2.</p>
<p>Some things explained in the rewrite rules:</p>
<p>1. %2 is a <strong><em>back-reference</em></strong> that is created in the second condition. <strong><em>Back-references</em></strong> are created by groups of parentheses in the condition pattern. So in this case, the first parenthesis (www.) will create first back-reference that can be used with %1, and the second one ([a-z0-9-]) , that matches the subdomain like form, will create the second back-reference, which we use with %2.</p>
<p>2. The flag <strong>NC</strong> at the end of the conditions and rule means that the comparisons should be made case insensitive (<em>No Case</em>).</p>
<p>3. The flag <strong>QSA</strong> at the end of the rule means that if there are additional queries at the end of URL string, they should be added to the URL when rewritten (<em></em><em>Q</em>uery <em>S</em>tring <em>A</em>ppend).</p>
<p>You might need  to make adjustments to the rewrite rule form, for example instead of index.php you have other landing page, or instead of the parameter <em>&#8220;topic&#8221; </em>you have other.</p>
<p>Source: <a href="http://dllurl.com/44">http://dllurl.com/44</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fmod-rewrite-for-subdomains%2F', 'Mod+Rewrite+for+Subdomains')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fmod-rewrite-for-subdomains%2F', title: '+Mod+Rewrite+for+Subdomains+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/codeigniter-open-source-php-web-application-framework/' rel='bookmark' title='Permanent Link: CodeIgniter &#8211; Open source PHP web application framework'>CodeIgniter &#8211; Open source PHP web application framework</a> <small>CodeIgniter is a powerful PHP framework with a very small...</small></li><li><a href='http://www.ajaxupdates.com/template-elements-css-framework/' rel='bookmark' title='Permanent Link: Template Elements &#8211; CSS Framework'>Template Elements &#8211; CSS Framework</a> <small>Elements is a down to earth CSS framework. It was...</small></li><li><a href='http://www.ajaxupdates.com/record-mouse-movement/' rel='bookmark' title='Permanent Link: Record Mouse Movement'>Record Mouse Movement</a> <small>The “movelogger” records the mouse movement a users does on...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/mod-rewrite-for-subdomains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax Count Words in Forms Script</title>
		<link>http://www.ajaxupdates.com/ajax-count-words-in-forms-script/</link>
		<comments>http://www.ajaxupdates.com/ajax-count-words-in-forms-script/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 20:46:45 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Forms / Fields]]></category>
		<category><![CDATA[ajax count words]]></category>
		<category><![CDATA[ajax forms]]></category>
		<category><![CDATA[count form words]]></category>
		<category><![CDATA[count script]]></category>
		<category><![CDATA[count words]]></category>
		<category><![CDATA[count words forms]]></category>
		<category><![CDATA[count words left]]></category>
		<category><![CDATA[counting words]]></category>
		<category><![CDATA[words in forms]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4530</guid>
		<description><![CDATA[ Sometimes you need to limit the number of input words on public forms, and it is hard for the visitor to approximate the number of words that he/she wrote already to see how much can still write. And it is annoying when after submitting the form they see the input is not valid because [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-alphanumerical-validation/' rel='bookmark' title='Permanent Link: Jquery Alphanumerical Validation'>Jquery Alphanumerical Validation</a> <small>I ran into a javascript alphanumeric validation problem, though it...</small></li><li><a href='http://www.ajaxupdates.com/validation-hints-for-forms/' rel='bookmark' title='Permanent Link: Validation Hints for Forms'>Validation Hints for Forms</a> <small>As someone is typing an in an input field, it...</small></li><li><a href='http://www.ajaxupdates.com/building-a-better-web-forms-context-highlighting-using-jquery/' rel='bookmark' title='Permanent Link: Building a better web forms : Context highlighting using jQuery'>Building a better web forms : Context highlighting using jQuery</a> <small>In my previous article &#8220;Labels in form layouts&#8221; I wrote...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p> Sometimes you need to limit the number of input words on public forms, and it is hard for the visitor to approximate the number of words that he/she wrote already to see how much can still write. And it is annoying when after submitting the form they see the input is not valid because they wrote too many words. For this case javascript can be the best solution.</p>
<p>How to do this: add a small readonly input that will show the number of left words. Every time an event that means that characters are added to the textarea, a javascript function will be called. The javascript function will count the number of words that are already in the box and display the number of words left in the small input field. The function will be presented later.</p>
<p>The events that need to be watched are: key up, key down and paste, so we will use the functions: onKeyDown, onKeyUp and onPaste.</p>
<p>Here follows the html part with the form and here the function CountWordsLeft is called in the conditions discussed earlier.</p>
<pre class="brush: html">  &lt;form name=&quot;count_form&quot; method=&quot;post&quot; action=&quot;&quot;&gt;

&lt;textarea name=&quot;desc&quot; cols=&quot;40&quot; rows=&quot;7&quot; id=&quot;desc&quot;
    onKeyDown=&quot;CountWordsLeft(count_form, document.count_form.desc, document.count_form.count,100);&quot;
    onKeyUp=&quot;CountWordsLeft(count_form, document.count_form.desc, document.count_form.count,100);&quot;
    onPaste=&quot;CountWordsLeft(count_form, document.count_form.desc, document.count_form.count,100);&quot;&gt;
&lt;/textarea&gt;

&lt;input readonly name=&quot;count&quot; type=&quot;text&quot; size=&quot;5&quot; value=&quot;100&quot;/&gt;

&lt;/form&gt;  </pre>
<p>The javascript function takes as parameters:<br />
    &#8211; myForm &#8211; the name of the form<br />
    &#8211; field &#8211; the name of the field we count words for, in out case the textarea named desc<br />
   &#8211; count &#8211; the name of the small readonly field that shows the left words<br />
    &#8211; no_words &#8211; maximum number of words allowed</p>
<p>The function works like this: first it removes all characters in front that are not alphanumeric (it will remove spaces for example) . Then in with the resulted string all non alphanumeric characters are replaced with space (&#8221; &#8220;). Only after that the text is split using space as a separator and the resulted words are counted. The count input box is updated with the number of words left. </p>
<pre class="brush: javascript"> function CountWordsLeft(myForm, field, count, no_words) {
    var text=field.value + &quot; &quot;;
    if(no_words&gt;0)
    {
        var iwhitespace = /^[^A-Za-z0-9]+/gi; // remove initial whitespace
        var left_trimmedStr = text.replace(iwhitespace, &quot;&quot;);
        var na = rExp = /[^A-Za-z0-9]+/gi; // non alphanumeric characters
        var cleanedStr = left_trimmedStr.replace(na, &quot; &quot;);
        var splitString = cleanedStr.split(&quot; &quot;);
        var word_count = splitString.length -1;
        count.value=no_words-word_count;
    }
}
  </pre>
<p><!--adsense--><br />
Demo: <a href="http://dllurl.com/41">http://dllurl.com/41</a><br />
Source: <a href="http://dllurl.com/42">http://dllurl.com/42</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fajax-count-words-in-forms-script%2F', 'Ajax+Count+Words+in+Forms+Script')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fajax-count-words-in-forms-script%2F', title: '+Ajax+Count+Words+in+Forms+Script+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jquery-alphanumerical-validation/' rel='bookmark' title='Permanent Link: Jquery Alphanumerical Validation'>Jquery Alphanumerical Validation</a> <small>I ran into a javascript alphanumeric validation problem, though it...</small></li><li><a href='http://www.ajaxupdates.com/validation-hints-for-forms/' rel='bookmark' title='Permanent Link: Validation Hints for Forms'>Validation Hints for Forms</a> <small>As someone is typing an in an input field, it...</small></li><li><a href='http://www.ajaxupdates.com/building-a-better-web-forms-context-highlighting-using-jquery/' rel='bookmark' title='Permanent Link: Building a better web forms : Context highlighting using jQuery'>Building a better web forms : Context highlighting using jQuery</a> <small>In my previous article &#8220;Labels in form layouts&#8221; I wrote...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/ajax-count-words-in-forms-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JQuery Google Feed Plugin</title>
		<link>http://www.ajaxupdates.com/jquery-google-feed-plugin/</link>
		<comments>http://www.ajaxupdates.com/jquery-google-feed-plugin/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 21:09:42 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Feeds]]></category>
		<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Jquery Script]]></category>
		<category><![CDATA[google feeds]]></category>
		<category><![CDATA[google jquery]]></category>
		<category><![CDATA[jfeeds]]></category>
		<category><![CDATA[jquery feed]]></category>
		<category><![CDATA[jquery feeds]]></category>
		<category><![CDATA[jquery feeds plugin]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4526</guid>
		<description><![CDATA[ Google announced the Google AJAX Feed API. This is a pretty cool thing as it facilitates feed mashups by providing the server component. This means that developers can easily mash feeds on the client by simply including Google&#8217;s new API script. And Google has provided a nice Developer&#8217;s Guide which shows how to get [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jfeed-jquery-feed-parser/' rel='bookmark' title='Permanent Link: jFeed &#8211; jQuery Feed Parser'>jFeed &#8211; jQuery Feed Parser</a> <small>A lightweight JavaScript feed parser based on jQuery and couldn&#8217;t...</small></li><li><a href='http://www.ajaxupdates.com/pulling-your-flickr-feed-with-jquery/' rel='bookmark' title='Permanent Link: Pulling Your Flickr Feed with jQuery'>Pulling Your Flickr Feed with jQuery</a> <small>Feeds are the easiest way to view updated content, whether...</small></li><li><a href='http://www.ajaxupdates.com/jsquared-is-a-jquery-plugin-for-ui-like-in-google-squared/' rel='bookmark' title='Permanent Link: jSquared is a jQuery plugin for UI like in Google Squared'>jSquared is a jQuery plugin for UI like in Google Squared</a> <small>This plugin allows you to organize advanced search user interface...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p> Google announced the Google AJAX Feed API. This is a pretty cool thing as it facilitates feed mashups by providing the server component. This means that developers can easily mash feeds on the client by simply including Google&#8217;s new API script. And Google has provided a nice Developer&#8217;s Guide which shows how to get started.<br />
To simplify this even more for jQuery developers, I&#8217;ve created a small plugin which performs the task of unobtrusively converting an element, such as an < a >, into a < div > element which holds feed content.</p>
<p>Update: On May 8th, Google announced the Feed Control. As a result, this plugin has been updated (and simplified!) to use the new Google control.</p>
<p>This page demonstrates the plugin by converting the markup displayed below into the feed content displayed in the sidebar to the right. </p>
<pre class="brush: html">
&lt;div id=&quot;feeds&quot;&gt;
    &lt;a class=&quot;feed&quot; href=&quot;http://jquery.com/blog/feed/&quot;&gt;jQuery Blog&lt;/a&gt;
    &lt;a class=&quot;feed&quot; href=&quot;http://www.learningjquery.com/feed/&quot;&gt;Learning jQuery&lt;/a&gt;
&lt;/div&gt;  </pre>
<p>Using the Google API, each anchor is converted to a series of semantic < div > elements which can be styled to your liking using CSS. The CSS structure of the generated markup is detailed here: http://code.google.com/apis/ajaxfeeds/documentation/reference.html</p>
<p>The following script is included in the head of this document: </p>
<pre class="brush: javascript">  &lt;!-- include Google Feed API --&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi?key=[your API key]&quot;&gt;&lt;/script&gt; 

&lt;!-- include this plugin --&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.gfeed.js&quot;&gt;&lt;/script&gt; 

&lt;script type=&quot;text/javascript&quot;&gt;
    // when the DOM is ready, convert the feed anchors into feed content
    $(document).ready(function() {
        $(&#039;a.feed&#039;).gFeed( { target: &#039;#feeds&#039;, tabs: true } );
    });
&lt;/script&gt;  </pre>
<p><strong>Options</strong><br />
Options can be passed to the gFeed method using an object literal. The following options are supported:</p>
<p>target<br />
    jQuery selector which identifies where the feed content should be inserted on the page.<br />
title<br />
    Allows you to provide a specific feed title to override the markup.<br />
url<br />
    Allows you to provide a specific url for the feed (which means you don&#8217;t have to use anchors).<br />
max<br />
    Identifies the maximum number of feed items to display for a given feed. The default is 5.<br />
tabs<br />
    true if feeds should be rendered using Google&#8217;s tabbed drawing mode.</p>
<p>Using the options argument we can limit each feed to only 3 items like this: </p>
<pre class="brush: javascript">  $(document).ready(function() {
    $(&#039;a.feed&#039;).gFeed( { max: 3 } );
});  </pre>
<p><strong>Manually Adding a Feed</strong><br />
Rather than convert existing elements to feeds, we can easily add feeds on the fly like this: </p>
<pre class="brush: javascript">   $(document).ready(function() {
    // add a feed manually
    $(&#039;#alistapart&#039;).gFeed({
        url: &#039;http://www.alistapart.com/feed/rss.xml&#039;,
        title: &#039;A List Apart Feed (Added by Brute Force)&#039;
    });
}); </pre>
<pre class="brush: html">   </pre>
<p><!--adsense--><br />
Download: <a href="http://dllurl.com/36">http://dllurl.com/36</a><br />
Source: <a href="http://dllurl.com/37">http://dllurl.com/37</a></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjquery-google-feed-plugin%2F', 'JQuery+Google+Feed+Plugin')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fjquery-google-feed-plugin%2F', title: '+JQuery+Google+Feed+Plugin+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/jfeed-jquery-feed-parser/' rel='bookmark' title='Permanent Link: jFeed &#8211; jQuery Feed Parser'>jFeed &#8211; jQuery Feed Parser</a> <small>A lightweight JavaScript feed parser based on jQuery and couldn&#8217;t...</small></li><li><a href='http://www.ajaxupdates.com/pulling-your-flickr-feed-with-jquery/' rel='bookmark' title='Permanent Link: Pulling Your Flickr Feed with jQuery'>Pulling Your Flickr Feed with jQuery</a> <small>Feeds are the easiest way to view updated content, whether...</small></li><li><a href='http://www.ajaxupdates.com/jsquared-is-a-jquery-plugin-for-ui-like-in-google-squared/' rel='bookmark' title='Permanent Link: jSquared is a jQuery plugin for UI like in Google Squared'>jSquared is a jQuery plugin for UI like in Google Squared</a> <small>This plugin allows you to organize advanced search user interface...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/jquery-google-feed-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Autopopulating Select Boxes</title>
		<link>http://www.ajaxupdates.com/autopopulating-select-boxes/</link>
		<comments>http://www.ajaxupdates.com/autopopulating-select-boxes/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 21:03:51 +0000</pubDate>
		<dc:creator>alyaspk</dc:creator>
				<category><![CDATA[Ajax Scripts]]></category>
		<category><![CDATA[Jquery Script]]></category>
		<category><![CDATA[auto populating]]></category>
		<category><![CDATA[auto populating boxes]]></category>
		<category><![CDATA[auto populating selec]]></category>
		<category><![CDATA[auto select]]></category>
		<category><![CDATA[auto select boxes]]></category>
		<category><![CDATA[auto selectboxes]]></category>
		<category><![CDATA[autopopulating]]></category>
		<category><![CDATA[populating boxes]]></category>

		<guid isPermaLink="false">http://www.ajaxupdates.com/?p=4523</guid>
		<description><![CDATA[Allow the user to select a top level category from one select box and to automatically populate the sub-category.
Prerequisites
   1. Latest copy of jQuery
   2. A basic understanding of JSON (don’t let this put you off &#8211; it’s really very, very easy)
   3. A server-side script that can respond [...]


Related Listings:<ol><li><a href='http://www.ajaxupdates.com/auto-populating-select-boxes-script/' rel='bookmark' title='Permanent Link: Auto Populating Select Boxes Script'>Auto Populating Select Boxes Script</a> <small>If you are familiar with using select boxes for categorisation...</small></li><li><a href='http://www.ajaxupdates.com/ajax-chained-select-script/' rel='bookmark' title='Permanent Link: AJAX Chained Select Script'>AJAX Chained Select Script</a> <small>PHP This script requires PHP. You can also other server...</small></li><li><a href='http://www.ajaxupdates.com/incremental-search-for-select-boxes-jquery-plugin/' rel='bookmark' title='Permanent Link: Incremental Search for Select Boxes &#8211; jQuery Plugin'>Incremental Search for Select Boxes &#8211; jQuery Plugin</a> <small>Did you ever have to scroll through a select box...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Allow the user to select a top level category from one select box and to automatically populate the sub-category.<br />
<strong>Prerequisites</strong></p>
<p>   1. Latest copy of jQuery<br />
   2. A basic understanding of JSON (don’t let this put you off &#8211; it’s really very, very easy)<br />
   3. A server-side script that can respond to the AJAX request (though I’ve provided a simple example)</p>
<p><strong>Demo</strong></p>
<p>Our demo will specifically look to build a simple form that allows us to book human resource for a project. The top level category is the resource type, and the sub-category will list the individual’s names.</p>
<p>See the demo in action<br />
<strong>How it works</strong></p>
<p>Once the top level category select is changed, it sends an AJAX request for the sub-categories. The result of which are converted to select options and the sub-category select’s elements are replaced.<br />
Unobtrusive JavaScript</p>
<p>First things first: as with any page that is loaded with JavaScript and AJAX functionality, it should work without JavaScript.</p>
<p>To achieve this for our tutorial here’s what we need to ensure:</p>
<p>   1. When the page is loaded, the sub-category is loaded (if the top level has a selected item).<br />
   2. There is a ‘load sub-category’ button the user can select to re-load the page. We will hide this button with a <noscript> tag in our demo.</p>
<p><strong>The Code</strong></p>
<p>There are 4 parts to this demo.</p>
<p>   1. The page’s HTML.<br />
   2. The server-side code to produce the dynamic page (i.e. to pre-load the select boxes when the user first visits).<br />
   3. The jQuery &#038; JavaScript.<br />
   4. The JSON response (which will reuse the server-side code).</p>
<p><strong>HTML</strong></p>
<pre class="brush: html">
&lt;form action=&quot;/select_demo.php&quot;&gt;
  &lt;label for=&quot;ctlJob&quot;&gt;Job Function:&lt;/label&gt;
  &lt;select name=&quot;id&quot; id=&quot;ctlJob&quot;&gt;
    &lt;option value=&quot;1&quot;&gt;Managers&lt;/option&gt;
    &lt;option value=&quot;2&quot;&gt;Team Leaders&lt;/option&gt;
    &lt;option value=&quot;3&quot;&gt;Developers&lt;/option&gt;
  &lt;/select&gt;
  &lt;noscript&gt;
    &lt;input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Load Individuals&quot; /&gt;
  &lt;/noscript&gt;
  &lt;label for=&quot;ctlPerson&quot;&gt;Individual:&lt;/label&gt;
  &lt;select name=&quot;person_id&quot; id=&quot;ctlPerson&quot;&gt;
    &lt;option value=&quot;1&quot;&gt;Mark P&lt;/option&gt;
    &lt;option value=&quot;2&quot;&gt;Andy Y&lt;/option&gt;
    &lt;option value=&quot;3&quot;&gt;Richard B&lt;/option&gt;
  &lt;/select&gt;
&lt;input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Book&quot; /&gt;
&lt;/form&gt;  </pre>
<p><strong>Server-side</strong></p>
<p>This is just a simple example, but it should be obvious that you can expand this to go off to a database and return an object in a JSON data structure:</p>
<pre class="brush: php">  &lt; ?php
if ($_GET[&#039;id&#039;] == 1) {
  echo &lt;&lt;&lt;HERE_DOC
[ {optionValue: 0, optionDisplay: &#039;Mark&#039;}, {optionValue:1, optionDisplay: &#039;Andy&#039;}, {optionValue:2, optionDisplay: &#039;Richard&#039;}]
HERE_DOC;
} else if ($_GET[&#039;id&#039;] == 2) {
  echo &lt;&lt;&lt;HERE_DOC
[{optionValue:10, optionDisplay: &#039;Remy&#039;}, {optionValue:11, optionDisplay: &#039;Arif&#039;}, {optionValue:12, optionDisplay: &#039;JC&#039;}]
HERE_DOC;
} else if ($_GET[&#039;id&#039;] == 3) {
  echo &lt;&lt;&lt;HERE_DOC
[{optionValue:20, optionDisplay: &#039;Aidan&#039;}, {optionValue:21, optionDisplay:&#039;Russell&#039;}]
HERE_DOC;
}?&gt; </pre>
<p>Note that this is not accessible. To ensure accessibility, the server side will handle the pre-population of the select boxes as the page is loaded. Here is an example (excluding the headers, footers and JavaScript) of the accessible example.<br />
<strong>JSON Response</strong></p>
<p>If I pass the server side id = 2, i.e. /select.php?id=2&#038;ajax=true, the return value is (the ajax=true is an arbitrary flag that I’m using to differentiate between a normal user request and one done via AJAX):</p>
<pre class="brush: javascript"> [ {optionValue:10, optionDisplay: &#039;Remy&#039;},
{optionValue:11, optionDisplay: &#039;Arif&#039;},
{optionValue:12, optionDisplay: &#039;JC&#039;}]  </pre>
<p>The enclosing square brackets denotes an array and each element is separated by a comma.</p>
<p>Within the array are three objects. If you’re familiar with PHP or Perl, you can basically treat these as hashes. The objects have keys (in this case two keys, one called ‘optionValue’ and one called ‘optionDisplay’), and values. Note that keys don’t need to be wrapped in quotes (though in some cases you will need them sometimes).</p>
<p><strong>jQuery &#038; AJAX Request</strong></p>
<p>Our JavaScript is going to attach itself after the page is load, and fire an event each time the job function select box is changed.</p>
<p>The event will send the new value of the select box and reload the contents of the person select box.</p>
<p>Note that I’m be a bit naughty here, in that I’m plugging HTML directly in to the DOM.</p>
<p>Each item in the JSON response is looped round and used to build up the new options for the select box. As the response is an array (as mentioned earlier), we can call the .length method on it.</p>
<pre class="brush: javascript">
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
$(function(){
  $(&quot;select#ctlJob&quot;).change(function(){
    $.getJSON(&quot;/select.php&quot;,{id: $(this).val(), ajax: &#039;true&#039;}, function(j){
      var options = &#039;&#039;;
      for (var i = 0; i &lt; j.length; i++) {
        options += &#039;&lt;option value=&quot;&#039; + j[i].optionValue + &#039;&quot;&gt;&#039; + j[i].optionDisplay + &#039;&#039;;
      }
      $(&quot;select#ctlPerson&quot;).html(options);
    })
  })
})
&lt;/script&gt;</pre>
<p><strong>Where to take it next</strong></p>
<p>So that’s the primer. Next steps: upgrade, integrate, extend and stylise. Below is an example of the category selection when submitting an item for sale on Ebay.<br />
<!--adsense--><br />
Demo: <a href="http://dllurl.com/24">http://dllurl.com/24</a><br />
Download: <a href="http://dllurl.com/25">http://dllurl.com/25</a><br />
Source: <a href="http://dllurl.com/23">http://dllurl.com/23</a></noscript></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fwww.ajaxupdates.com%2Fautopopulating-select-boxes%2F', 'Autopopulating+Select+Boxes')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fwww.ajaxupdates.com%2Fautopopulating-select-boxes%2F', title: '+Autopopulating+Select+Boxes+' })"/></div>

<p>Related Listings:<ol><li><a href='http://www.ajaxupdates.com/auto-populating-select-boxes-script/' rel='bookmark' title='Permanent Link: Auto Populating Select Boxes Script'>Auto Populating Select Boxes Script</a> <small>If you are familiar with using select boxes for categorisation...</small></li><li><a href='http://www.ajaxupdates.com/ajax-chained-select-script/' rel='bookmark' title='Permanent Link: AJAX Chained Select Script'>AJAX Chained Select Script</a> <small>PHP This script requires PHP. You can also other server...</small></li><li><a href='http://www.ajaxupdates.com/incremental-search-for-select-boxes-jquery-plugin/' rel='bookmark' title='Permanent Link: Incremental Search for Select Boxes &#8211; jQuery Plugin'>Incremental Search for Select Boxes &#8211; jQuery Plugin</a> <small>Did you ever have to scroll through a select box...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ajaxupdates.com/autopopulating-select-boxes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->