<?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>Php Development &#187; jquery</title>
	<atom:link href="http://www.maheshchari.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maheshchari.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 23 May 2010 05:10:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jquery multiple instances</title>
		<link>http://www.maheshchari.com/jquery-multiple-instances/</link>
		<comments>http://www.maheshchari.com/jquery-multiple-instances/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 00:47:32 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=532</guid>
		<description><![CDATA[jQuery multiple instances
here we learn how to apply our jQuery plug in for each element with our plugin instance .
by default JavaScript assumes each variable and object are static, if you change any where it remains stateless.
To understand this code we must aware of 

JavaScript scope of variables.
jquery basics.

Download Demo

&#40;function&#40;$&#41;&#123;
instanceId=0;	
	$.fn.my_plugin=function&#40;options&#41;&#123;
		//default options for our plugin
		defaultOptions=&#123;instanceData:'mahesh'&#125;;
		return this.each&#40;function&#40;&#41;&#123;
		//for [...]]]></description>
			<content:encoded><![CDATA[<h1>jQuery multiple instances</h1>
<p>here we learn how to apply our jQuery plug in for each element with our plugin instance .<br />
by default JavaScript assumes each variable and object are static, if you change any where it remains stateless.<br />
To understand this code we must aware of </p>
<ul>
<li>JavaScript scope of variables.</li>
<li>jquery basics.</li>
</ul>
<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/jquery-multiple-instance.zip'>Download Demo</a></h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
instanceId<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>	
	$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">my_plugin</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//default options for our plugin</span>
		defaultOptions<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span>instanceData<span style="color: #339933;">:</span><span style="color: #3366CC;">'mahesh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">//for every element we create new instance options</span>
		<span style="color: #006600; font-style: italic;">// remember here {} ,means we create empty object and extend with </span>
		<span style="color: #006600; font-style: italic;">//default options</span>
		<span style="color: #006600; font-style: italic;">//user options</span>
		options<span style="color: #339933;">=</span>$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>defaultOptions<span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		<span style="color: #006600; font-style: italic;">//call the function that create new instance object of our plugin </span>
		$.<span style="color: #660066;">my_pluginInstanceCreater</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
$.<span style="color: #660066;">my_pluginInstanceCreater</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>target<span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//if given target element  don't have already instance of our plugin</span>
	<span style="color: #006600; font-style: italic;">//then we create a new instance and assign it to target</span>
	<span style="color: #006600; font-style: italic;">//if target elment has already instance of our plugin return it</span>
	<span style="color: #000066; font-weight: bold;">return</span> target.<span style="color: #660066;">my_plugin</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>target.<span style="color: #660066;">my_plugin</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> $.<span style="color: #660066;">my_pluginInstance</span><span style="color: #009900;">&#40;</span>target<span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// this is main core plugin instance where we code every thing </span>
$.<span style="color: #660066;">my_pluginInstance</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>target<span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	$<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">instanceData</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'  ,Instance Id: '</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>instanceId<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #006600; font-style: italic;">// function to create our own plugin scope of variables</span></pre></div></div>

<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/jquery-multiple-instance.zip'>Download Demo</a></h3>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=532&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/jquery-multiple-instances/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>hide browser  context menu -jquery</title>
		<link>http://www.maheshchari.com/hide-browser-context-menu-jquery/</link>
		<comments>http://www.maheshchari.com/hide-browser-context-menu-jquery/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 12:38:39 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=465</guid>
		<description><![CDATA[Hide the web browser context menu with jquery
Sometimes we need to prevent the context menu from the browser when user right clicks on the element . for example preventing the user from saving image from application,viewing the source code of the web page.
it is very simple to do that using jquery with  &#8220;contextmenu&#8221; event

jQuery&#40;&#41;.ready&#40;function&#40;&#41;&#123;
jQuery&#40;'img'&#41;.bind&#40;'contextmenu',function&#40;&#41;&#123;return [...]]]></description>
			<content:encoded><![CDATA[<h1>Hide the web browser context menu with jquery</h1>
<p>Sometimes we need to prevent the context menu from the browser when user right clicks on the element . for example preventing the user from saving image from application,viewing the source code of the web page.<br />
it is very simple to do that using jquery with  &#8220;contextmenu&#8221; event</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'contextmenu'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>
In the above example we disabled context menu on the images by saving. we can see this demo on my previous post about the jquery <a href="http://www.maheshchari.com/jquery-mouse-gestures-real-demo/" target="_blank">mouse gestures</a>.</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=465&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/hide-browser-context-menu-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jquery mouse gestures real demo</title>
		<link>http://www.maheshchari.com/jquery-mouse-gestures-real-demo/</link>
		<comments>http://www.maheshchari.com/jquery-mouse-gestures-real-demo/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 12:27:26 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=456</guid>
		<description><![CDATA[A Simple jQuery mouse gestures demo and tutorial. 
You can see this example live over top of my blog header, it shows mouse left,right,middle ,over events live. here we learn how did i implemented this.
HTML of demo
Here we use simple logic  with four layers for each mouse event. code shown below

&#60;div id=&#34;mouse-div&#34;&#62;
  &#60;div [...]]]></description>
			<content:encoded><![CDATA[<h1>A Simple jQuery mouse gestures demo and tutorial. </h1>
<p><a href="http://www.maheshchari.com/wp-content/uploads/2010/03/mouse.png"><img src="http://www.maheshchari.com/wp-content/uploads/2010/03/mouse.png" alt="" title="mouse" width="200" height="240" class="alignleft size-full wp-image-462" /></a>You can see this example live over top of my blog header, it shows mouse left,right,middle ,over events live. here we learn how did i implemented this.</p>
<h3>HTML of demo</h3>
<p>Here we use simple logic  with four layers for each mouse event. code shown below</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;mouse-div&quot;&gt;
  &lt;div id=&quot;mouse-parts&quot;&gt;
    &lt;div id=&quot;mouse-left&quot;&gt;&amp;nbsp;&lt;/div&gt;
    &lt;div id=&quot;mouse-right&quot;&gt;&amp;nbsp;&lt;/div&gt;
    &lt;div id=&quot;mouse-blink&quot;&gt;&amp;nbsp;&lt;/div&gt;    
    &lt;div id=&quot;mouse-middle&quot;&gt;&amp;nbsp;&lt;/div&gt;
  &lt;/div&gt;</pre></div></div>

<h3>CSS of Demo</h3>
<p>Total mouse main element <b>#mouse-div</b> was positioned absolutely with mouse background.</p>
<p>mouse main element has another element called <b>#mouse-parts</b> and positioned relatively with main element.</p>
<p><b>#mouse-left</b> element positioned with main background and its mouse left click event background matched exactly with absolute positioning.</p>
<p><b>#mouse-right</b> element positioned with main background and its mouse right click event background matched exactly with absolute positioning.</p>
<p><b>#mouse-middle</b> element positioned with main background and its mouse middle  click event background matched exactly with absolute positioning.</p>
<p><b>#mouse-blink</b> element positioned with main background and its mouse over  event background matched exactly with absolute positioning.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#mouse-div</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">240px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">51px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mouse.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#mouse-div</span> <span style="color: #cc00cc;">#mouse-parts</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#mouse-parts</span> <span style="color: #cc00cc;">#mouse-blink</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">43px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">45px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mouse-over.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #993333;">center</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">114px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">165px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#mouse-parts</span> <span style="color: #cc00cc;">#mouse-left</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">141px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">114px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mouse-left.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">24px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#mouse-parts</span> <span style="color: #cc00cc;">#mouse-right</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">142px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">110px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mouse-right.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">62px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#mouse-parts</span> <span style="color: #cc00cc;">#mouse-middle</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">128px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">82px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">mouse-middle.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">33px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-1px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>jQuery Code</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-div'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-blink'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-blink'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
.<span style="color: #660066;">mousedown</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//fire the each event when mouse button pressed</span>
e.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-left'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//show the mouse-left element over the mouse that was brightened</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-right'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//show the mouse-right element over the mouse that was brightened</span>
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-middle'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//show the mouse-middle element over the mouse that was brightened</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
.<span style="color: #660066;">mouseup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#mouse-left,#mouse-right,#mouse-middle'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #006600; font-style: italic;">//reset the all images to hidden state when mouse released</span>
.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'contextmenu'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//hide the default context menu when right clicking on main element.</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/jquery-mouse-guestures.zip'>View Demo and Download &#8216;jquery mouse guestures&#8217;</a></h3>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=456&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/jquery-mouse-gestures-real-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery ajaxstart ajaxstop</title>
		<link>http://www.maheshchari.com/jquery-ajaxstart-ajaxstop/</link>
		<comments>http://www.maheshchari.com/jquery-ajaxstart-ajaxstop/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 11:14:48 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=393</guid>
		<description><![CDATA[Displaying Ajax started element using JQuery ajaxstart,ajaxstop
jQuery is most famous javascript library compared to its concurrents. One of importent functionality in jQuery is its Ajax handling. It has very flexible methods for Ajax.We seen how to handle the Ajax Errors in my previous Article.Here we concentrate on jQuery ajaxstart,ajaxstop default methods to handle globally. 
Present [...]]]></description>
			<content:encoded><![CDATA[<h2>Displaying Ajax started element using JQuery ajaxstart,ajaxstop</h2>
<p>jQuery is most famous javascript library compared to its concurrents. One of importent functionality in jQuery is its Ajax handling. It has very flexible methods for Ajax.We seen how to handle the Ajax Errors in my previous Article.Here we concentrate on jQuery ajaxstart,ajaxstop default methods to handle globally. </p>
<p>Present it is very common to use ajax for every functionality,while querying externel resources with ajax we have to show the end user there is something happening behind the page.Some novice users don&#8217;t know about this functionality. So we must intimate the end user we are working on back end. Some times Ajax calls takes more time to respond with some reason. in that case most users confused about it may be stopped working . so here we take one example and tutorial.</p>
<h3>ajaxStart</h3>
<p>This method is called globally by jQuery while before starting any ajax call starts.</p>
<h3>ajaxstop</h3>
<p>This method called after stopping the Ajax stopped successfully or Ajax call cancelled.</p>
<p>These methods called on $.getJSON,$.get,$.post,$().load,$.getScript function.</p>
<h3>Example</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javacript" style="font-family:monospace;">jQuery().ready(function(){ //Dom ready 
$('#loadimg').ajaxStart(function(){$(this).show();});//this method for ajax start		
$('#loadimg').ajaxStop(function(){$(this).hide();});//this method for ajax stop
$('#loadjson').click(function(){
$.getJSON('ajax.js',function(d){alert(d.name);});//$.getJSON method
});
$('#loadelement').click(function(){$(this).load('loadsnippet.html')});//load method
});</pre></td></tr></table></div>

<p><a href="http://www.maheshchari.com">Try more examples</a></p>
<p>&nbsp;</p>
<p><a href='http://www.maheshchari.com/wp-content/uploads/2010/01/ajaxstart.zip'>Demo Download</a></p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=393&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/jquery-ajaxstart-ajaxstop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery ajax error handling</title>
		<link>http://www.maheshchari.com/jquery-ajax-error-handling/</link>
		<comments>http://www.maheshchari.com/jquery-ajax-error-handling/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 13:05:19 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=244</guid>
		<description><![CDATA[How to handle ajax errors using jQuery ? 
jQuery is the most awesome javascript library that made easy for asynchronous ajax calls.it has global ajax function and some pre defined ajax functions like $.get, $.post, load .etc. but we don&#8217;t find any error messages by default with this library. we can see the errors with [...]]]></description>
			<content:encoded><![CDATA[<h1>How to handle ajax errors using jQuery ? </h1>
<p><strong>jQuery</strong> is the most awesome javascript <strong>library</strong> that made easy for <strong>asynchronous ajax </strong>calls.it has global <strong>ajax</strong> function and some pre defined ajax functions like <strong>$.get</strong>, <strong>$.post</strong>,<strong> load</strong> .etc. but we don&#8217;t find any <strong>error messages</strong> by default with this library. we can see the errors with firefox&#8217;s addon <strong>firebug</strong> or with <strong>IE developer toolbar</strong>.So we manage most common ajax errors in our application with global <strong>ajaxSetup</strong> function which come with <strong>jQuery</strong> by default. We can set many options,to see available <strong>ajaxsetup</strong> options please check <a href="http://docs.jquery.com/Ajax/jQuery.ajax#toptions" target="_blank" rel="nofallow">here</a>. </p>
<p>most ajax errors we get errors are server response errors and some <strong>JSON</strong> parse errors. To know more about the <strong>HTTP</strong> errors details please check <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" target="_blank" rel="nofallow">here</a>. To test this error handling just copy and paste it to your head section of HTML document. </p>
<h3>Javascript Code for setting global error handling. </h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">ajaxSetup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		error<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x.<span style="color: #000066;">status</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'You are offline!!<span style="color: #000099; font-weight: bold;">\n</span> Please Check Your Network.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x.<span style="color: #000066;">status</span><span style="color: #339933;">==</span><span style="color: #CC0000;">404</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Requested URL not found.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x.<span style="color: #000066;">status</span><span style="color: #339933;">==</span><span style="color: #CC0000;">500</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Internel Server Error.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">==</span><span style="color: #3366CC;">'parsererror'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Error.<span style="color: #000099; font-weight: bold;">\n</span>Parsing JSON Request failed.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e<span style="color: #339933;">==</span><span style="color: #3366CC;">'timeout'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Request Time out.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Unknow Error.<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #339933;">+</span>x.<span style="color: #660066;">responseText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In the above example we handle following common error and show response text for other rare errors.</p>
<ul>
<li>0-xhr status ,is it initialized or not that means user is offline. </li>
<li>404-page not found </li>
<li>500-Internel Server error. </li>
<li>request timeout &#8211; jQuery custom error.</li>
<li> parseerror-jQuery custom error when parsing JSON data. </li>
<li>we just throw other errors with response error </li>
</ul>
<h2>Example1</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">params<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'mahesh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span>params<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>In above example,jQuery automatically raises all available errors,except parse error. because we didn&#8217;t give any return type format. </p>
<h2>Example2</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">params<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'mahesh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span>params<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'json'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span>params<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In above example,jQuery automatically raises all available errors,because we added return type format at end. $.getJSON automatically adds the return type of parameter to &#8220;JSON&#8221;</p>
<h3>Example3</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">params<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">name</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'mahesh'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span>params<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>
In the above example 3 ,we gave xml type return parameter, here also jQuery automatically raises all errors even parse error also.</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=244&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/jquery-ajax-error-handling/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>stop browser cache</title>
		<link>http://www.maheshchari.com/stop-browser-cache/</link>
		<comments>http://www.maheshchari.com/stop-browser-cache/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 16:57:58 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=237</guid>
		<description><![CDATA[How to stop the web browser caching the document
All web  documents, media and other web resources retrieved by a Web browser, are often saved, or cached, locally on the user&#8217;s hard drive. The next time that media or web resources is requested the Web browser may load the file from the cache instead of [...]]]></description>
			<content:encoded><![CDATA[<h1>How to stop the web browser caching the document</h1>
<p>All <strong>web  documents</strong>, <strong>media</strong> and other web <strong>resources</strong> retrieved by a <strong>Web browser</strong>, are often <strong>saved</strong>, or <strong>cached</strong>, <strong>locally</strong> on the user&#8217;s <strong>hard drive</strong>. The next time that <strong>media</strong> or <strong>web resources</strong> is requested the <strong>Web browser</strong> may load the file from the cache instead of downloading it over the <strong>internet</strong>. This might be <strong>desirable</strong> for a some web document content doesn&#8217;t change often but undesirable for documents are updated frequently with new content or information.<br />
All <strong>web servers</strong> sends to the browser with  some basic information about the document before it sent .in the above example we can see some of them.for full details please refer <a rel="nofollow" href="http://www.w3.org/Protocols/rfc2068/rfc2068" target="_blank">here</a> . we can use this server side <strong>headers</strong> to <strong>prevent</strong> browser <strong>caching</strong> .we learn here only <strong>PHP</strong> related headers.</p>
<h3>preventing browser cache with javascript.</h3>
<p>Here i am showing basic jQuery plugin that appends a random time to each links in document.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">nocachelink</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//itereate trough each element in given element collection</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> href<span style="color: #339933;">=</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>href.<span style="color: #660066;">lastIndexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'?'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//if query string is set or not for link</span>
			href<span style="color: #339933;">=</span>href<span style="color: #339933;">+</span><span style="color: #3366CC;">'?'</span><span style="color: #339933;">+</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
			href<span style="color: #339933;">=</span>href<span style="color: #339933;">+</span><span style="color: #3366CC;">'&amp;'</span><span style="color: #339933;">+</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #339933;">,</span>href<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// update new href attribute</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>An example how to use it</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.nocache'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">nocachelink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>preventing browser cache with meta tags.</h3>
<p>to prevent cache by means of html meta tags add following tags to  document head section.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;&gt;
&lt;meta http-equiv=&quot;Expires&quot; content=&quot;-1&quot;&gt;
&lt;meta http-equiv=&quot;CACHE-CONTROL&quot; content=&quot;NO-CACHE&quot;&gt;</pre></div></div>

<h3>preventing browser cache with server side headers.</h3>
<p>we can also use HTTP headers by php also as below,remember you must add this lines to start of code.</p>

<div class="wp_syntax"><div class="code"><pre class="1" style="font-family:monospace;">//  @-silenced or error suppress operater
	@header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
	@header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
	@header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
	@header( 'Pragma: no-cache' );</pre></div></div>

<h3>preventing browsers cache with ajax calls.</h3>
<p>we can also set headers with ajax response headers.</p>
<h3>preventing browser cache with other methods.</h3>
<p>By default all browser don&#8217;t cache <strong>SSL layered documents.</strong><br />
below example document won&#8217;t cached by browsers.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">https://www.yourdomain.com</pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=237&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/stop-browser-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>introduction to javascript framework  jquery</title>
		<link>http://www.maheshchari.com/jquery-introduction/</link>
		<comments>http://www.maheshchari.com/jquery-introduction/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 04:47:48 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=197</guid>
		<description><![CDATA[jquery introduction
What is jQuery?
JQuery is a JavaScript framework that makes writing advanced JavaScript very easy.
You can learn easily jQuery even you know basic knowledge in JavaScript. It has many useful JavaScript function to support cross browser JavaScript compatibility.
Where can you get it?
The official jQuery website (http://jquery.com) is always the most up-to-date resource for code and [...]]]></description>
			<content:encoded><![CDATA[<h1>jquery introduction</h1>
<h3>What is jQuery?</h3>
<p><strong>JQuery</strong> is a JavaScript framework that makes writing advanced JavaScript very easy.<br />
You can learn easily <strong>jQuery </strong>even you know basic knowledge in JavaScript. It has many useful JavaScript function to support cross browser JavaScript compatibility.</p>
<h3>Where can you get it?</h3>
<p>The official <strong>jQuery</strong> website (<a href="http://jquery.com">http://jquery.com</a>) is always the most up-to-date resource for code and news related to the library. To get started, we need a copy of <strong>jQuery</strong>, which can be downloaded right from the home page of the site. Several versions of jQuery may be available at any given moment; the latest uncompressed version will be most appropriate for developers like you. You can find documentation here (<a href="http://docs.jquery.com">http://docs.jquery.com</a>).</p>
<h3>How to install and run jQuery?</h3>
<p>Since <strong>jQuery</strong> is a pre built function library in JavaScript, we can include normal external JavaScript files after downloading it from core <strong>jQuery</strong> web site.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function(){
//do magic with jQuery here
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<h3>What you can do with jQuery?</h3>
<p>Easy Dom selectors (css, javascript, xpath, Dom).<br />
Ajax.<br />
Easy Dom manipulation<br />
Easy Dom traversing<br />
Use pre programmed number of jQuery plug-ins.<br />
Cross browser supported event handling.<br />
Utility functions.<br />
Flash like animation.<br />
And you can develop complex web applications with less coding….more.</p>
<h3>How to use Magic method of jQuery $().ready or $(document).ready?</h3>
<p>Generally browser loads external CSS and JavaScript files first and after loads the document element model and assigns corresponding objects by loading from server.<br />
This loading of all objects called window load and when it completed browser triggers window.load event. But we can manipulate the document after the document element model. This event occurs before window.load event. Some A grade browsers supports this DOM ready event. So cross browser compatibility jQuery added this magic method to find the Dom ready event.<br />
We call this method as below</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>‘Dom loaded’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Document parameter is optional, if no parameter given jQuery assumes the document.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066;">alert</span> <span style="color: #009900;">&#40;</span>‘Dom loaded’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Generally we call the window load event with jQuery as below,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">alert</span> <span style="color: #009900;">&#40;</span>‘window loaded completely’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=197&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/jquery-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
