<?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>Bagesh Singh&#039;s Blog -  A blog about PHP, Ajax, JavaScript, CSS, Web 2.0 and Web Development &#187; javascript</title>
	<atom:link href="http://www.bageshsingh.com/bagesh-blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bageshsingh.com/bagesh-blog</link>
	<description>The shortest distance to a software &#38; web solutions</description>
	<lastBuildDate>Tue, 07 Sep 2010 16:42:26 +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>38 jQuery And CSS Drop Down Multi Level Menu Solutions</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/07/38-jquery-and-css-drop-down-multi-level-menu-solutions/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/07/38-jquery-and-css-drop-down-multi-level-menu-solutions/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 15:54:42 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[coding technique]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=611</guid>
		<description><![CDATA[Hello again, it’s time for comprehensive programming article. Here you’ll find 38 mainly jquery and CSS based drop-down or just multi level menu tutorials with down loadable files and explanations as well. My favorite here is the first pick – Outside the box with very unique navigation menu. It’s always good to have such reference [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again, it’s time for comprehensive programming article. Here you’ll find 38 mainly jquery and CSS based drop-down or just multi level menu tutorials with down loadable files and explanations as well. My favorite here is the first pick – Outside the box with very unique navigation menu. It’s always good to have such reference articles in your bookmarks and when you have to create some really big website with a lot of content and menu sections – just return here. Shorten your developing process with already premade menus, which can be easily modified with little touch of CSS.<br />
1. “Outside the Box” Navigation with jQuery</p>
<p>This tutorial will cover a few ways to do just that with OS X style docks and stacks navigation.</p>
<p>2. Sexy Drop Down Menu w/ jQuery &amp; CSS</p>
<p>In this tutorial you will learn how to create a sexy drop down menu that can also degrade gracefully.</p>
<p>3. Designing the Digg Header: How To &amp; Download</p>
<p>Navigation is compacted with the use of simple drop-down menus.</p>
<p>4. Create The Fanciest Dropdown Menu You Ever Saw</p>
<p>5. A circular menu with sub menus</p>
<p>A follow on from the simple single level circular menu, this one adds a sub menu level of smaller icons in a circular pattern within the top level circle. There is also the facility to add a simple description of each icon.</p>
<p>6. A Different Top Navigation</p>
<p>In this tutorial you will use jQuery to create a different multi-layered horizontal navigation system that is still intuitive enough for anyone to use for the first time.</p>
<p>Preview Demo<br />
7. Perfect signin dropdown box likes Twitter with jQuery</p>
<p>Nice tutorial showing you how to create a login drop down with Twitter style using jQuery.</p>
<p>8. Sliding Jquery Menu Tutorial</p>
<p>This tutorial will show you how to create a sliding menu button using jquery. You can see the effect in action over on the PSDtuts webpage in the top right hand corner.</p>
<p>9.Fancy Sliding Menu for Mootools</p>
<p>10. Create Vimeo-like top navigation</p>
<p>I’ve featured this Janko’s tutorial some time ago, but sometimes I will repeat myself, since this article is completely dedicated to showcase advanced drop down menus. Very detailed and well written tutorial, with drop-down search options narrowing and targeting search by checking options. Menu is done completely using just CSS, structure is visually describet in the image below:</p>
<p>Preview Demo<br />
11. Dynamic PHP/CSS menu</p>
<p>12. Creating an Outlook Navigation Bar using the ListView and Accordion Controls</p>
<p>Preview Demo<br />
13. Animated Drop Down Menu with jQuery</p>
<p>14. jQuery UI Potato Menu</p>
<p>Preview Demo<br />
15. Make a Mega Drop-Down Menu with jQuery</p>
<p>Preview Demo<br />
16. A cross-browser drop-down cascading validating menu</p>
<p>Just simple CSS menu.</p>
<p>Preview Demo<br />
17. Drop-Down Menus, Horizontal Style</p>
<p>Very old drop-down tutorial from year 2004, but if you are starting out – very useful tutorial and example.</p>
<p>Preview Demo<br />
18. Superfish v1.4.8 – jQuery menu plugin by Joel Birch</p>
<p>Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu (so it degrades gracefully without JavaScript) and more features.</p>
<p>Preview Demo<br />
19. JavaScript Dropdown Menu with Multi Levels</p>
<p>This multi-level drop down menu script weighs in at only 1.2 KB. It features animation, active header persistence, easy implementation and multiple instance support.</p>
<p>Preview Demo<br />
20. jQuery (mb)Menu 2.7</p>
<p>This is a powerful jQuery component to build easily a multilevel tree menu or a contextual menu (right click) in an intuitive way!</p>
<p>Preview Demo<br />
21. Menumatic</p>
<p>MenuMatic is a MooTools 1.2 class that takes a sematic ordered or unordered list of links and turns it into a dynamic drop down menu system. For users without javascript, it falls back on a CSS menu</p>
<p>Preview Demo<br />
22. Smooth Navigational Menu (v1.31)</p>
<p>Smooth Navigation Menu is a multi level, CSS list based menu powered using jQuery that makes website navigation a smooth affair.</p>
<p>Preview Demo<br />
23. jQuery File Tree</p>
<p>jQuery File Tree is a configurable, AJAX file browser plugin for jQuery. You can create a customized, fully-interactive file tree with as little as one line of JavaScript code.</p>
<p>Preview Demo<br />
24. Longed-For Multi-Level Drop-Down Menu Script</p>
<p>Preview Demo<br />
25. jQuery &amp; CSS Example – Dropdown Menu</p>
<p>This article is intended to describe an extremely basic, yet extremely powerful, technique for adding dropdown menus in your application user interface or website design.</p>
<p>Preview Demo<br />
26. Reinventing a Drop Down with CSS and jQuery</p>
<p>Preview Demo<br />
27. Simple jQuery Dropdowns</p>
<p>Very stripped down code and minimal styling, yet still dropdown menu has all the functionality typically needed.</p>
<p>Preview Demo<br />
28. Styling Drop Down Boxes with jQuery</p>
<p>One problem with HTML forms is it is hard to style the elements to fit into your design. The tutorial will show you how to style the hardest of them all, the select box.</p>
<p>Preview Demo<br />
29. jQuery iPod-style Drilldown Menu</p>
<p>Preview Demo<br />
30. jQuery Menu: Dropdown, iPod Drilldown, and Flyout styles with ARIA Support and ThemeRoller Ready</p>
<p>Newer version of previous iPod style menu.</p>
<p>Preview Demo<br />
31. mcDropdown jQuery Plug-in v1.2.07</p>
<p>Preview Demo<br />
32. jQuery Drop Line Tabs</p>
<p>This menu turns a nested UL list into a horizontal drop line tabs menu. The top level tabs are rounded on each side thanks to the use of two transparent background images, while the sub ULs each appear as a single row of links that drop down when the mouse rolls over its parent LI.</p>
<p>Preview Demo</p>
<p>33. Cut &amp; Paste jQuery Mega Menu</p>
<p>Mega Menus refer to drop down menus that contain multiple columns of links. This jQuery script lets you add a mega menu to any anchor link on your page, with each menu revealed using a sleek expanding animation. Customize the animation duration plus delay before menu disappears when the mouse rolls out of the anchor. Mega cool!</p>
<p>Preview Demo<br />
34. Professional dropdown #2</p>
<p>Preview Demo<br />
35. Drop down menu with nested submenus</p>
<p>Create your own drop down menu with nested submenus using CSS and a little JavaScript.</p>
<p>Preview Demo<br />
36. jdMenu Hierarchical Menu Plugin</p>
<p>The jdMenu plugin for jQuery provides a clean, simple and elegant solution for creating hierarchical drop down menus for websites to web applications.</p>
<p>Preview Demo<br />
37. Dynamic Drive – Multiple Level Menus</p>
<p>A lot of free advanced CSS and Javascript drop down menus are available here. There are also instructions and advices how do use and modify them.</p>
<p>38. IzzyMenu – Menu Builder – Build your pro CSS/DHTML Menu</p>
<p>Choose from dozens ready styles or create your own menu style. They are low in file size, so won’t consume a lot of bandwidth from your hosting. IzzyMenu, online menu generator is the best solution for amateurs and professionals!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/07/38-jquery-and-css-drop-down-multi-level-menu-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento: Creating Ajax Updated Tabs In Frontend, Like Product Management Tabs of Backend</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/06/magento-creating-ajax-updated-tabs-in-frontend-like-product-management-tabs-of-backend/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/06/magento-creating-ajax-updated-tabs-in-frontend-like-product-management-tabs-of-backend/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 11:39:44 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[Interview Question]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[PHP Third Party Tools]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[magento interview question]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=603</guid>
		<description><![CDATA[Magento’s Product Management GUI in back-end has Tabbed Navigation. There are two types of Tabs implemented there. One type of Tab is normal tab, loading content on page load while other type of tab has its content loaded by “Ajax”. Another interesting thing to note is that once the Ajax loaded tab’s content is loaded [...]]]></description>
			<content:encoded><![CDATA[<p>Magento’s Product Management GUI in back-end has Tabbed Navigation. There are two types of Tabs implemented there. One type of Tab is normal tab, loading content on page load while other type of tab has its content loaded by “Ajax”. Another interesting thing to note is that once the Ajax loaded tab’s content is loaded it will not “recall” Ajax to load its content, rather earlier loaded tab content is show. If are “confused” then just see how the “Categories” tab of the Product Management works.</p>
<p>A good trick, I thought while doing this, using class name to restrict the Ajax cal</p>
<p>I successfully used the same “behavior” of tabbed navigation in “front-end”, was easy at the end (always with Magento, when you get it), but I was struggling at the start. So, like my other posts, to share here’s how I used the same type of tab in Magento’s Front-end.</p>
<p>First thing is add the Tab’s Java-script file. You can either include by layout or in PHTML file. If you want to do from layout then,1	&lt;reference name=&#8221;head&#8221;&gt;<br />
2	             &lt;action method=&#8221;addJs&#8221;&gt;&lt;script&gt;mage/adminhtml/tabs.js&lt;/script&gt;&lt;/action&gt;<br />
3	&lt;/reference&gt;</p>
<p>Next thing is to create Tab’s Menu inside UL &amp; LI. Here’s the structure. (Self Explanatory)01	&lt;!&#8211; TAB MENU STRUCTURE &#8211;&gt;<br />
02<br />
03	&lt;ul id=&#8221;page_tabs&#8221;&gt;<br />
04	    &lt;!&#8211; NORMAL TAB &#8211;&gt;<br />
05	    &lt;li&gt;<br />
06	        &lt;a id=&#8221;normaltab&#8221; name=&#8221;normaltab&#8221; href=&#8221;#&#8221;&gt; NORMAL TAB &lt;/a&gt;<br />
07	        &lt;!&#8211; NOTE: class has to be tab-item-link&#8211;&gt;<br />
08<br />
09	        &lt;div id=&#8221;normaltab_content&#8221;&gt; Normal Tab HTML&lt;/div&gt;<br />
10	        &lt;!&#8211; NOTE: See the id of this div content it has id equal to its anchor&#8217;s (&lt;a&gt;) id + Underscore + content &#8211;&gt;<br />
11	    &lt;/li&gt;<br />
12	    &lt;!&#8211; NORMAL TAB END&#8211;&gt;<br />
13<br />
14	    &lt;!&#8211; AJAX LOADED TAB &#8211;&gt;<br />
15	    &lt;li&gt;<br />
16	        &lt;a id=&#8221;ajaxtab&#8221; name=&#8221;ajaxtab&#8221; href=&#8221;http://example.com/magento/module/controller/action&#8221;&gt; AJAX TAB &lt;/a&gt;<br />
17	        &lt;!&#8211; NOTE 1: class has to be tab-item-link ajax notloaded &#8211;&gt;<br />
18	        &lt;!&#8211; NOTE 2: Since this is Ajax Loaded Tab its Anchor should have href value = SOME URL &#8211;&gt;<br />
19<br />
20	        &lt;div id=&#8221;ajaxtab_content&#8221;&gt;&lt;/div&gt;<br />
21	        &lt;!&#8211; NOTE 1: See the id of this div content it has id equal to its anchor&#8217;s (&lt;a&gt;) id + Underscore + content &#8211;&gt;<br />
22	        &lt;!&#8211; NOTE 2: Since its innerHTML will be loaded by by Ajax you can set its innerHTML &#8220;blank&#8221; &#8211;&gt;<br />
23<br />
24	    &lt;/li&gt;<br />
25	    &lt;!&#8211; AJAX LOADED TAB END &#8211;&gt;<br />
26	&lt;/ul&gt;<br />
27	&lt;!&#8211; TAB MENU STRUCTURE END &#8211;&gt;<br />
28<br />
29	&lt;!&#8211; TAB CONTENT CONTAINER DIV&#8211;&gt;<br />
30	&lt;div id=&#8221;tabcontainer&#8221;&gt;&lt;/div&gt;<br />
31	&lt;!&#8211; TAB CONTENT CONTAINER DIV&#8211;&gt;</p>
<p>Now its the time to use the Tabs JS included, like below.01	&lt;script&gt;<br />
02	    // Form Key Required for POST AJAX Method<br />
03	    var FORM_KEY=&#8221;&lt;?php echo Mage::getSingleton(&#8216;core/session&#8217;)-&gt;getFormKey() ?&gt;&#8221;;<br />
04<br />
05	    // Set this to false, Guess used for some other purpose in backend, not really required in frontend.<br />
06	    var varienGlobalEvents=false;<br />
07<br />
08	    // Initiallizing Varien Tabs<br />
09	    /**<br />
10	    * @param 1 : UL Menu ID<br />
11	    * @param 2 : Target Tab Content ID<br />
12	    * @param 3 : Initially Loading Tab&#8217;s Id<br />
13	    * @param 4 : Don&#8217;t know yet, just use as it is (LOL)<br />
14	    */<br />
15<br />
16	    frontend_tabsJsTabs = new varienTabs(&#8216;page_tabs&#8217;, &#8216;tabcontainer&#8217;, &#8216;normaltab&#8217;,[]);<br />
17<br />
18	&lt;/script&gt;</p>
<p>Done! You must now have a functioning Tab loading by Ajax and Normal, but yes tab would look good if you add CSS to your Tabs.  Here is how it works.<br />
On load it first copies the tab_content div inside the Target Tab Content ID div.<br />
On tabbed menu clicked it checks its class name and if it class name does not have “ajax” it simply shows the its_content div.<br />
If the menu clicked has “ajax” then it checks for another class name “notloaded”. So if its ajax and notloaded it then makes an Ajax request and updates the responseText to itsid_content div and then removes the “notloaded” class name for the menu. After that it then displays the itsid_content div, hiding previous ones.<br />
If you re-click the “Ajax” typed menu, it will not find “notloaded” class in its menu, then it just shows its_content div.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/06/magento-creating-ajax-updated-tabs-in-frontend-like-product-management-tabs-of-backend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tabbed Infowindow in Google Maps</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/04/tabbed-infowindow-in-google-maps/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/04/tabbed-infowindow-in-google-maps/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 13:50:57 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=460</guid>
		<description><![CDATA[I wanted to show different categories of information on one GMarker.  That is I wanted to show different types of information on a Infowindow  for a point on Google Maps. For that I used a tabbed info window, which  helped me to show different data on each tabs. Here is the code [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to show different categories of information on one GMarker.  That is I wanted to show different types of information on a Infowindow  for a point on Google Maps. For that I used a tabbed info window, which  helped me to show different data on each tabs. Here is the code of what I  have done. I have shown the latitude and longitude of a placed clicked  on the map on the tabbed info window. This is just the script part. The  demo and download links are given below.</p>
<div id="highlighter_92575">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>01</code></td>
<td><code>&lt;script type=</code><code>"text/javascript"</code><code>&gt;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>02</code></td>
<td><code> </code><code>var</code> <code>iconBlue = </code><code>new</code> <code>GIcon();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>03</code></td>
<td><code> </code><code>iconBlue.image = </code><code>'<a href="http://labs.google.com/ridefinder/images/mm_20_blue.png">http://labs.google.com/ridefinder/images/mm_20_blue.png</a>'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>04</code></td>
<td><code> </code><code>iconBlue.shadow = </code><code>'<a href="http://labs.google.com/ridefinder/images/mm_20_shadow.png">http://labs.google.com/ridefinder/images/mm_20_shadow.png</a>'</code><code>;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>05</code></td>
<td><code> </code><code>iconBlue.iconSize = </code><code>new</code> <code>GSize(12, 20);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>06</code></td>
<td><code> </code><code>iconBlue.shadowSize = </code><code>new</code> <code>GSize(22, 20);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>07</code></td>
<td><code> </code><code>iconBlue.iconAnchor = </code><code>new</code> <code>GPoint(6, 20);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>08</code></td>
<td><code> </code><code>iconBlue.infoWindowAnchor = </code><code>new</code> <code>GPoint(5, 1);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>09</code></td>
<td><code> </code><code>var</code> <code>point = </code><code>new</code> <code>GLatLng(26.88157422515243,  86.30859375);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code> </code><code>function</code> <code>load() {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code> </code><code>if</code> <code>(GBrowserIsCompatible())  {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code> </code><code>var</code> <code>map = </code><code>new</code> <code>GMap2(document.getElementById(</code><code>"map"</code><code>));</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code> </code><code>map.setCenter(point,3);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code> </code><code>GEvent.addListener(map, </code><code>'click'</code><code>, </code><code>function</code><code>(overlay,  point) {</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code> </code><code>var</code> <code>lati=point.lat();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code> </code><code>var</code> <code>long=point.lng();</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code> </code><code>var</code> <code>marker= </code><code>new</code> <code>GMarker(</code><code>new</code> <code>GLatLng(lati,  long),{draggable: </code><code>false</code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>18</code></td>
<td><code> </code><code>map.addOverlay(marker);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>19</code></td>
<td><code> </code><code>var</code> <code>infoTabs =  [ </code><code>new</code> <code>GInfoWindowTab(</code><code>"Lat-Tab"</code><code>, </code><code>"&lt;h1&gt;  Latitude:&lt;/h1&gt;&lt;br /&gt;"</code><code>+lati), </code><code>new</code> <code>GInfoWindowTab(</code><code>"Long-Tab"</code><code>, </code><code>"&lt;h1&gt;Longitude&lt;/h1&gt;&lt;br  /&gt;"</code><code>+long)];</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>20</code></td>
<td><code> </code><code>marker.openInfoWindowTabsHtml(infoTabs);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>21</code></td>
<td><code> </code><code>});</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>22</code></td>
<td><code> </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>23</code></td>
<td><code> </code><code>}</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>24</code></td>
<td><code> </code><code>&lt;/script&gt;</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Lets focus on the <strong>#17-#26</strong> Lines of codes. Other  Lines are already described on other posts. Please see the related post  link below the post.<br />
<strong>#17:</strong> Creates a GMarker on the point where clicked on  the Map.<br />
<strong>#18:</strong> Addes the GMarker over the Map.<br />
<strong>#19:</strong> Initiates an array of tabs<strong>infoTabs </strong> with <strong>GInfoWindowTab </strong> function with <strong>tabname</strong> and its <strong>innerHTML</strong> as parameters.<br />
<strong>#20:</strong> Opens the infowindow calling <strong>openInfoWindowTabsHtml</strong> function and the array of tabs as parameters.</p>
<p><a href="http://subeshexamples.googlecode.com/files/tabinfo.html"><strong>[Download]</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/04/tabbed-infowindow-in-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animated content navigation effect using jquery</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/animated-content-navigation-effect-using-jquery-2/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/animated-content-navigation-effect-using-jquery-2/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 12:00:33 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/2010/03/animated-content-navigation-effect-using-jquery-2/</guid>
		<description><![CDATA[I always get bored with the same stuffs. And, I see  same kind of content navigation to the different websites. Click a link,  let’s the whole web page gets loaded and new page gets displayed. It  would be better to show another content in the same page with few  animation without [...]]]></description>
			<content:encoded><![CDATA[<p>I always get bored with the same stuffs. And, I see  same kind of content navigation to the different websites. Click a link,  let’s the whole web page gets loaded and new page gets displayed. It  would be better to show another content in the same page with few  animation without loading the whole page.</p>
<p>In this post, I’ll show you how to make various  animation to the content using jQuery. First of let’s start looking at  the HTML and CSS code,</p>
<p><strong>HTML Code for animated content navigation </strong></p>
<pre>&lt;a href="#home" class="linkclass" &gt;Home&lt;/a&gt;
&lt;a href="#about_us" class="linkclass" &gt;About Us&lt;/a&gt;
&lt;a href="#service" class="linkclass" &gt;Services&lt;/a&gt;
&lt;a href="#contact_us" class="linkclass" &gt;Contact Us&lt;/a&gt;

&lt;div class="container"&gt;
    &lt;div id="home" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="about_us" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="service" class="msg_body"&gt; content goes here &lt;/div&gt;
    &lt;div id="contact_us" class="msg_body"&gt;  content goes here &lt;/div&gt;
&lt;/div&gt;</pre>
<p>As you can see above, the “href” attribute of the  anchor tag is pointing to the id of the “div”. “Home” anchor tag is  pointing to “#home”. In jquery, id of a element is represented by adding  “#” prefix to the id of that element.</p>
<p><strong>CSS code for animated content navigation</strong></p>
<pre>.container
{
   width:312px;
   margin-top:20px;
}
.msg_body
{
  border:1px solid #CCCCCC;
  padding: 5px;
  width: 300px;
  background-color:#F4F4F8;
  text-align:justify;
  position:absolute;
}
.linkclass
{
  font-weight:bold;
  color:#006699;
}</pre>
<p>Above CSS code is pretty straight forward and you can  change it according to your need. Note that, there is position  attribute to “absolute” in the “msg_body” class. Now let’s look at  various the javaScript code in jQuery to make the various animated  content navigation</p>
<p><strong>Faded content navigation </strong></p>
<pre> //hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
  $('.msg_body').fadeOut("slow");
  $($(this).attr("href")).fadeIn("slow");
});</pre>
<p>In the first line of javaScript code, all the element  with class “msg_body” is made hidden except the first element with same  class. And when the anchor with class “linkclass” is clicked, the  element with class “msg_body” gets faded out which is being displayed in  browser. And, the element with the id value in the “href” attribute of  the clicked anchor tag, get displayed in browser with fading effect.</p>
<p><strong>Shutter like content navigation effect </strong></p>
<pre>//hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
   $('.msg_body').hide("fast");
   $($(this).attr("href")).show("slow");
});</pre>
<p>The code is same as the above code but here “hide()”  and “show()” function of jQuery is used to hide and display the content  in different manner.</p>
<p><strong>Sliding Content Navigation Effect </strong></p>
<pre> //hide the all div except first one
 $('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets faded
$("a.linkclass").click(function()
{
   $('.msg_body').slideUp("slow");
   $($(this).attr("href")).slideDown("slow"););
});</pre>
<p>This is another content navigation effect with  sliding manner. “slideUp()” and “slideDown()” functions of jQuery is  used to display this kind of effect.</p>
<p><strong><a href="http://roshanbh.com.np/codes/content-move.zip">Download full  source code</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/animated-content-navigation-effect-using-jquery-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jquery : Benefits, Examples and Free Ebook</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/jquery-benefits-examples-and-free-ebook-2/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/jquery-benefits-examples-and-free-ebook-2/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:10:05 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[e-book]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=164</guid>
		<description><![CDATA[What is jQuery?
Directly taken from the website of jQuery -” jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages”.It is basically a JavaScript framework for writing huge task of JavaScript with few lines of code.
What are the benefits [...]]]></description>
			<content:encoded><![CDATA[<h4>What is jQuery?</h4>
<p>Directly taken from the website of jQuery -” jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages”.It is basically a JavaScript framework for writing huge task of JavaScript with few lines of code.</p>
<h4>What are the benefits of jQuery?</h4>
<p><strong>1) </strong>5 lines of code of jQuery can perform better task than 25 lines of traditional Javascript code.<br />
<strong> 2) </strong>Various number of plugins are available and a large community support this project it is better to use jQuery in your project compared to other JavaScript frameworks like prototype.js or moottools .<br />
<strong> 3) </strong>jQuery’s website contains very good documentation with useful examples.<br />
<strong> 4) </strong>It simplifies the Ajax Development. Just have to write 5 or 6 lines to call the Ajax. Isn’t that easy??</p>
<p>Well these are just few benefits of jQuery but if you start using jQuery then you’ll come to know about the actual benefits of using jQuery. And believe me, It worth using jQuery in your web applications otherwise just blame me.</p>
<h4>Basic Examples of jQuery :</h4>
<pre>$(document).ready(function()
{
    $(".button").click(function ()
    {
      $("p").hide("slow");
    });
});</pre>
<p>In the above example, when a element with class “button” is clicked, all the paragraph element (“p”) will be hidden in the whole document in slow movement i.e. with slight animation.</p>
<pre>$(document).ready(function()
{
      $("#divid").load("sample.php");
});</pre>
<p>Above is the example Ajax using jQuery, look how simple it is to use ajax using jquery.The response got from the sample.php file is filled inside the element whose id is “divid”.</p>
<h4>Free Ebook for download :</h4>
<p>Well I’ve downloaded a E-book of jQuery in chm format.It contains chm version of the document found in docs.jquery.com. This E-book contains the very good documentation as well as useful examples.</p>
<p>You can <a title="jquery ebook" href="http://roshanbh.com.np/ebooks/jQuery-1.2-v1.zip" target="_blank">download the Ebook by clicking here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/jquery-benefits-examples-and-free-ebook-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image hover effect using jQuery</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/image-hover-effect-using-jquery/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/image-hover-effect-using-jquery/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:09:00 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[image hover]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=162</guid>
		<description><![CDATA[In this post, I’ll show you how to make a image hover effect using “div” in jquery.Take a look at a telebid.com if you put the mouse over the bid button it will be changed to login and afterwards it become bid button.

Step 1:
First of all, define two classes in css one for “loginimage” and [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, I’ll show you how to make a image hover effect using “div” in jquery.Take a look at a telebid.com if you put the mouse over the bid button it will be changed to login and afterwards it become bid button.</p>
<p><a href="http://roshanbh.com.np/examples/imagerollover/" target="_blank"></a></p>
<p><strong>Step 1:</strong><br />
First of all, define two classes in css one for “loginimage” and the another for “bidimage” in the “style.css” file</p>
<pre>.bidimage
{
  background-image:url(images/bid.gif);
  background-repeat:no-repeat;
  height:28px;
  width:62px;
  cursor:pointer;
}       

.loginimage
{
  background-image:url(images/login.gif);
  background-repeat:no-repeat;
  height:28px;
  width:62px;
  cursor:pointer;
}</pre>
<p>Since image is used as the background in div, the height and width should be defined and declared one pixel more than the background image.</p>
<p>Now, keep in the following division in the “index.html” inside the body tag.</p>
<pre>&lt;div class="bidimage"&gt; &lt;/div&gt;</pre>
<p>Now, define the script for the hover effect using jQuery inside the the “index.html” file.</p>
<pre>&lt;script&gt;
$(document).ready(function()
{
  $("div.bidimage").mouseover(function ()
  {
    $(this).addClass("loginimage");
  });

  $("div.bidimage").mouseout(function ()
  {
    $(this).removeClass("loginimage");
  });
});
&lt;/script&gt;</pre>
<p>As you can see above in the script, when mouse is over div with the class bidimage the “loginimage” class is added the that div.And, when mouse is out the “loginimage” class is removed from the division.</p>
<p><a href="http://roshanbh.com.np/codes/imagerollover.zip" target="_blank">Click here to download the full source codes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/image-hover-effect-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display different color in alternate row using jquery</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/display-different-color-in-alternate-row-using-jquery/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/display-different-color-in-alternate-row-using-jquery/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:07:54 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=160</guid>
		<description><![CDATA[Most of the tabular data are organized in such a manner that they are easy to read. And for this, most of the developers use different color to highlight the alternate row.There are various method of displaying different row in different color but here I’m going to use the most simple method using jQuery.

I’m going [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the tabular data are organized in such a manner that they are easy to read. And for this, most of the developers use different color to highlight the alternate row.There are various method of displaying different row in different color but here I’m going to use the most simple method using jQuery.<strong><br />
</strong></p>
<p>I’m going to show you the examples both in “tables” and “div”.</p>
<p>First , define the tables and div as shown below in the “index.html” file,</p>
<pre>&lt;table border="1"&gt;
  &lt;tr&gt;&lt;td&gt;Michael&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Sam&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Jason&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

 &lt;div&gt;Michael&lt;/div&gt;
 &lt;div&gt;Sam&lt;/div&gt;
 &lt;div&gt;John&lt;/div&gt;
 &lt;div&gt;Jason&lt;/div&gt;</pre>
<p>Now, we need to write the  script for displaying the different color in the alternate row,</p>
<pre>&lt;script src="jquery.js"&gt;&lt;/script&gt;

&lt;script&gt;
$(document).ready(function()
{
  //for div
  $("div:odd").css("background-color", "#F4F4F8");
  $("div:even").css("background-color", "#EFF1F1");

  //for table row
  $("tr:even").css("background-color", "#F4F4F8");
  $("tr:odd").css("background-color", "#EFF1F1");
});
&lt;/script&gt;</pre>
<p>The filters “even” and “odd” can be used in jQuery for selecting odd or even index of the elements.As you can see above the background color of the odd and even “div” are changed using the “css” method and “odd” and “even” filters of jQuery and the same applies for the even and odd “tr” which means for the row of table.</p>
<p><strong><a href="http://roshanbh.com.np/codes/alternaterowcolor.zip" target="_blank">Download Full Source Code</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/display-different-color-in-alternate-row-using-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to make accordion using jquery and css</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/how-to-make-accordion-using-jquery-and-css/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/how-to-make-accordion-using-jquery-and-css/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:02:41 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=152</guid>
		<description><![CDATA[Last time I’ve written an article about how to make expand-collapse toggle panel using jQuery. Now, this time I’ll show you how to make collipsible accordion using jQuery.An accordion is a toggle pane where one pane slides down the other pane slides up.

 HTML Code :
&#60;div id="firstpane" class="msg_list"&#62;
 &#60;p class="msg_head"&#62;News-Head-1 &#60;/p&#62;
  &#60;div class="msg_body"&#62;
   orem ipsum dolor [...]]]></description>
			<content:encoded><![CDATA[<p>Last time I’ve written an article about how to make expand-collapse toggle panel using jQuery. Now, this time I’ll show you how to make collipsible accordion using jQuery.An accordion is a toggle pane where one pane slides down the other pane slides up.<strong><br />
</strong></p>
<p><strong> HTML Code :</strong></p>
<pre>&lt;div id="firstpane" class="msg_list"&gt;
 &lt;p class="msg_head"&gt;News-Head-1 &lt;/p&gt;
  &lt;div class="msg_body"&gt;
   orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  &lt;/div&gt;
&lt;p class="msg_head"&gt;News-Head-2&lt;/p&gt;
 &lt;div class="msg_body"&gt;
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
 &lt;/div&gt;
&lt;p class="msg_head"&gt;News-Head-3&lt;/p&gt;
 &lt;div class="msg_body"&gt;
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
 &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Since, I’ve shown two examples, I’ve distinguished two container with two different id “firstpane” and “secondpane”.The html code of above is of first pane, The second pane’s HTML code is same with different id of the container “div”.</p>
<p><strong>CSS Code :</strong></p>
<pre>p {
 padding: 0 0 1em;
 }
 .msg_list {
 list-style: none;
margin: 0;
padding: 0;
width: 383px;
 }
 .msg_head {
 padding: 5px 10px;
cursor: pointer;
position: relative;
background-color:#FFCCCC;
margin:1px;
 }
.msg_body {
 padding: 5px 10px 15px;
background-color:#F4F4F8;
 }</pre>
<p>the above CSS code is straightforward for making collapsible accordion and you can change the various attribute of the class as your need. But keep in mind that the “position” property of “msg_head” should be “relative”.</p>
<p><strong>Javascript Code:</strong></p>
<pre>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;</pre>
<p>First of all, jQuery library is added in our source code. And the following codes are used for displaying the effect of expanding and collapsing.</p>
<pre>//hide the all of the element with class msg_body
$(".msg_body").hide();

//slides the element with class "msg_body" when paragraph with class "msg_head" is clicked
$("#firstpane p.msg_head").click(function()
{
  $(this).next("div.msg_body").slideToggle(700).siblings("div.msg_body").slideUp("slow");
});

//slides the element with class "msg_body" when mouse is over the paragraph
$("#secondpane p.msg_head").mouseover(function()
{
  $(this).next("div.msg_body").slideDown("slow").siblings("div.msg_body").slideUp("slow");
});</pre>
<p>As you can in the firt line, all the element with the class “msg_body” is hidden in the document. And after that, when a paragraph with class “msg_head” within id “firstpane” is cliked , the next “div” element with class “msg_body” is slidded toggling. But for the “secondpane”, when mouse is moved over the element with class “msg_head”, the next element with class “msg_body” gets slided down and all the other siblings with class “msg_body” gets slided up creating the effect of collapsible accordion.</p>
<p><strong><a href="http://roshanbh.com.np/codes/accordion-jquery.zip" target="_blank">Click here to download the full source code</a> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/how-to-make-accordion-using-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display random number in random way using JavaScript</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/display-random-number-in-random-way-using-javascript/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/display-random-number-in-random-way-using-javascript/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:01:40 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[Home]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tips and technique]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[random number]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=150</guid>
		<description><![CDATA[I think you guys already know about how to get the random number using JavaScript, if you don’t know then you can use Math.random() to display a random no ranging from 0 to 1. It would have been better if we display the random number in the random way using JavaScript. Ok, Let’s do it..
Displaying [...]]]></description>
			<content:encoded><![CDATA[<p>I think you guys already know about how to get the random number using JavaScript, if you don’t know then you can use Math.random() to display a random no ranging from 0 to 1. It would have been better if we display the random number in the random way using JavaScript. Ok, Let’s do it..</p>
<p><strong>Displaying random number in the random way </strong></p>
<p>To display random number in the random way, what we need is get the random number and write the random in a certain interval.</p>
<p><strong>HTML Code :</strong></p>
<p>As you can see above, the “div” with id “random” gets updated within specified interval and when button is clicked it call the JavaScript function “randValue()”. The first parameter is the maximum of the random number and second parameter specifies how many times the action should be repeated to show the final random number.</p>
<p><strong>JavaScript Code :</strong></p>
<pre>&lt;script&gt;
var i=1; //counter
function randValue(maxVal,no_of_time)
{
  i++; //counter increment
  document.getElementById('random').innerHTML=''; //element made blank
  //get a random no upto maxVal and round it to two decimal place
  var theNumber = (Math.random()*parseInt(maxVal)).toFixed(2);
  //put the number to that
  document.getElementById('random').innerHTML=theNumber; //gett
  if(i&lt;=no_of_time)
    setTimeout("randvalue("+maxVal+","+no_of_time+")",300);
  else
    i=1;
}
&lt;/script&gt;</pre>
<p>As you can see in the first line, counter is set to 1. In the first line of the function, counter is incremented. And then, the content of the “div” is made blank.</p>
<pre>var theNumber = (Math.random()*parseInt(maxVal)).toFixed(2);</pre>
<p>As you can in this line, the random no is multiplied with the supplied argument to get the random number between zero to maxVal since Math.random() only returns the random number between 0 to 1. And, “<span style="color: #333399;">toFixed(2)</span>” expression rounds the number to two decimal places. And that number is placed in the “div”.And then “<span style="color: #333399;">setTimeout()</span>” calls the same function in every 300 millisecond until the counter reaches to “no_of_time”. And, finally the counter is set to 1 to iterate through the same action.</p>
<p><strong><a href="http://roshanbh.com.np/codes/random-way.zip" target="_blank">Download Source code</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/display-random-number-in-random-way-using-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>check username availability in ajax and php using jquery’s fading effect</title>
		<link>http://www.bageshsingh.com/bagesh-blog/2010/03/check-username-availability-in-ajax-and-php-using-jquery%e2%80%99s-fading-effect-3/</link>
		<comments>http://www.bageshsingh.com/bagesh-blog/2010/03/check-username-availability-in-ajax-and-php-using-jquery%e2%80%99s-fading-effect-3/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 07:00:16 +0000</pubDate>
		<dc:creator>Bagesh Singh</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[username availability]]></category>

		<guid isPermaLink="false">http://www.bageshsingh.com/bagesh-blog/?p=148</guid>
		<description><![CDATA[In this post,I’ll show you how to make a fancy username availability checking in ajax and php using jquery.When, you check the the username avaiability a fancy message box will show you the message with a little bit of animation. If you are looking for such kind of effect for checking username availability, then this [...]]]></description>
			<content:encoded><![CDATA[<p>In this post,I’ll show you how to make a fancy username availability checking in ajax and php using jquery.When, you check the the username avaiability a fancy message box will show you the message with a little bit of animation. If you are looking for such kind of effect for checking username availability, then this might be right post for you.</p>
<p><strong></p>
<p></strong></p>
<p>Now let’s check it how to do check the username avaiability in ajax and php using jQuery.</p>
<p><strong>Html Code :</strong></p>
<pre>&lt;div &gt;
 User Name : &lt;input name="username" type="text" id="username" value="" maxlength="15" /&gt;
 &lt;span id="msgbox" style="display:none"&gt;&lt;/span&gt;
&lt;/div&gt;</pre>
<p>As you can see the above the “span” with id “msgbox” will show you the username availability message from ajax.</p>
<p><strong>Css code :</strong></p>
<pre>.messagebox{
 position:absolute;
 width:100px;
 margin-left:30px;
 border:1px solid #c93;
 background:#ffc;
 padding:3px;
}
.messageboxok{
 position:absolute;
 width:auto;
 margin-left:30px;
 border:1px solid #349534;
 background:#C9FFCA;
 padding:3px;
 font-weight:bold;
 color:#008000;
}
.messageboxerror{
 position:absolute;
 width:auto;
 margin-left:30px;
 border:1px solid #CC0000;
 background:#F7CBCA;
 padding:3px;
 font-weight:bold;
 color:#CC0000;
}</pre>
<p>I’ve defined three different class for three type of different message class “messagebox” for “checking….” message, “messageboxok” and “messageboxerror” class for displaying username available and not available messages.</p>
<p>As you know you can change the attriubutes of the css of the above code but keep in mind that “position” property should be “absolute”.</p>
<p><strong>Javascript code :</strong></p>
<p>First of  all, the jQuery library is used,</p>
<pre>&lt;script src="jquery.js" type="text/javascript" language="javascript"&gt;&lt;/script&gt;</pre>
<p>And when the focus is moved from the textbox of username the following function is called which call “user_availability.php” through ajax and display the appropriate message with fading effect.</p>
<pre>$("#username").blur(function()
{
 //remove all the class add the messagebox classes and start fading
 $("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
 //check the username exists or not from ajax
 $.post("user_availability.php",{ user_name:$(this).val() } ,function(data)
 {
  if(data=='no') //if username not avaiable
  {
   $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
   {
    //add message and change the class of the box and start fading
    $(this).html('This User name Already exists').addClass('messageboxerror').fadeTo(900,1);
   });
  }
  else
  {
   $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
   {
    //add message and change the class of the box and start fading
    $(this).html('Username available to register').addClass('messageboxok').fadeTo(900,1);
   });
  }
 });
});</pre>
<p>As you can see in the first line, “all” css class is removed from the div displaying the message and then “messagebox” class is added to that that element with adding the text “checking” within the element and displaying with fading effect.</p>
<p>After that, ajax is used to call the PHP file, and when response is received through Ajax then jQuery is used to show the respective message-box with fading effects.</p>
<p><strong>Php Code:</strong></p>
<pre>//this varible contains the array of existing users
$existing_users=array('roshan','mike','jason');
//value got from the get metho
$user_name=$_POST['user_name'];
//checking weather user exists or not in $existing_users array
if (in_array($user_name, $existing_users))
{
 //user name is not available
 echo "no";
}
else
{
  //username available i.e. user name doesn't exists in array
  echo "yes";
}</pre>
<p>In the above PHP code, I’ve added three usernames in a array and then check weather that user exists or not in that array and print “yes” or “no” accordingly. The response taken from ajax is used within JavaScript function to display the appropriate message.But, you can use database connection to check the the availability of username in your code.</p>
<p><strong><a href="http://roshanbh.com.np/codes/username-available.zip" target="_blank">Download full source</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bageshsingh.com/bagesh-blog/2010/03/check-username-availability-in-ajax-and-php-using-jquery%e2%80%99s-fading-effect-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
