<?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>TutorBoy &#187; Javascript</title>
	<atom:link href="http://articles.tutorboy.com/topics/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://articles.tutorboy.com</link>
	<description>Log on to Techknowledgey</description>
	<lastBuildDate>Wed, 18 Jan 2012 09:06:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>jQuery: Grouping Elements on MouseOver Event</title>
		<link>http://articles.tutorboy.com/2011/06/11/jquery-grouping-elements-on-mouseover-event/</link>
		<comments>http://articles.tutorboy.com/2011/06/11/jquery-grouping-elements-on-mouseover-event/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 10:28:35 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MouseOver Event]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2839</guid>
		<description><![CDATA[Grouping elements on mouse over, for example, If You have two div elements div#leftBox and div#rightBox,  div#rightBox containing a ...]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-2842" href="http://articles.tutorboy.com/2011/06/11/jquery-grouping-elements-on-mouseover-event/jquery_grouping_elements_mouseover/"><img class="alignright size-thumbnail wp-image-2842" title="jQuery Grouping Elements MouseOver" src="http://articles.tutorboy.com/content/uploads/2011/06/jQuery_Grouping_Elements_MouseOver-150x150.png" alt="" width="150" height="150" /></a>Grouping elements on mouse over, for example, If You have two div elements div#leftBox and div#rightBox,  div#rightBox containing a group of different items in random order, and div#leftBox contains a items unique item from the div#rightBox. The task is to group similar items on mouse over of div#leftBox items.<span id="more-2839"></span></p>
<p><a class="view-demo" title="Demo: jQuery, Grouping Elements on MouseOver Event" href="http://demo.tutorboy.com/articles/jQuery_Grouping_Elements_MouseOver.html">View Demo</a></p>
<h2>HTML</h2>
<pre class="brush:html">&lt;div id="leftBox"&gt;
	&lt;div&gt;GREEN&lt;/div&gt;
	&lt;div&gt;BLUE&lt;/div&gt;
	&lt;div&gt;RED&lt;/div&gt;
&lt;/div&gt;

&lt;div id="rightBox"&gt;
	&lt;div&gt;GREEN&lt;/div&gt;
	&lt;div&gt;BLUE&lt;/div&gt;
	&lt;div&gt;RED&lt;/div&gt;
	&lt;div&gt;GREEN&lt;/div&gt;
	&lt;div&gt;BLUE&lt;/div&gt;
	&lt;div&gt;RED&lt;/div&gt;
	&lt;div&gt;GREEN&lt;/div&gt;
	&lt;div&gt;BLUE&lt;/div&gt;
	&lt;div&gt;RED&lt;/div&gt;
	&lt;div&gt;GREEN&lt;/div&gt;
&lt;/div&gt;</pre>
<h2>jQuery</h2>
<pre class="brush:js">$(document).ready(function() {
	var main = $('#rightBox div').clone(true);
	$("div#leftBox div").mouseover(function(){

		$("div#rightBox ."+$(this).attr('class')).each(function() {
			$("div#rightBox").prepend($(this));
		});

	}).mouseout(function() {
		$('#rightBox').empty().append(main);
	});
});</pre>
<p><strong>Hint</strong><br />
First we will attach mouse over event to the left div elements and select the class name of current item. and store the right div item to variable &#8216;main&#8217; to restore original order. On each mouse over parse the right div with current left items class name, and add each item as first child of the right div.</p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/06/11/jquery-grouping-elements-on-mouseover-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript &#8211; Floating-Point Rounding Error</title>
		<link>http://articles.tutorboy.com/2011/06/04/floating-point-rounding-error/</link>
		<comments>http://articles.tutorboy.com/2011/06/04/floating-point-rounding-error/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 19:15:28 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Floating-Point]]></category>
		<category><![CDATA[IEEE]]></category>
		<category><![CDATA[IEEE 754]]></category>
		<category><![CDATA[Rounding-error]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2831</guid>
		<description><![CDATA[In JavaScript the floating-point values includes a decimal point and at least one number after the decimal point. The floating-point ...]]></description>
			<content:encoded><![CDATA[<p>In JavaScript the floating-point values includes a decimal point and at least one number after the decimal point. The floating-point values are accurate upto 17 decimal places, but it is less accurate in arithmetic numbers when considering with whole numbers. For instance, <span id="more-2831"></span>adding 0.2 and 0.1 gives 0.30000000000000004 instead of 0.3. Sometimes we don&#8217;t get the expected result because of this small rounding errors.</p>
<pre class="brush:js">var x = 0.1, y = 0.2;
alert(" x + y = "+ (x+y)); // x + y = 0.30000000000000004</pre>
<p>Here the sum of two numbers is tested to see if it&#8217;s equal to 0.3. This will work for 0.05 and 0.25 as well as 0.15 and 0.15.</p>
<pre class="brush:js">var x = 0.05, y = 0.25;
alert(" x + y = "+ (x+y)); // x + y = 0.3</pre>
<p>Therefore you should never test for specific floating-point values. The rounding errors are a side effects of the way floating-points arithmetic is done in <a title="IEEE 754-1985 - Wikipedia" href="http://en.wikipedia.org/wiki/IEEE_754-1985" target="_blank">IEEE 754</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/06/04/floating-point-rounding-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jsFiddle &#8211;  An Online Editor for JavaScripts, HTML5 and CSS3</title>
		<link>http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/</link>
		<comments>http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 05:35:19 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Reference]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript Framework]]></category>
		<category><![CDATA[jQuery Plug-in]]></category>
		<category><![CDATA[jsfiddle]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2652</guid>
		<description><![CDATA[Recently I was thinking about to design a Live editor for CSS and HTML, while googling I found an amazing ...]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-2657" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-home-screen2/"><img class="size-thumbnail wp-image-2657 alignleft" title="jsfiddle.home.screen2" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.home_.screen2-150x150.png" alt="" width="150" height="150" /></a>Recently I was thinking about to design a Live editor for CSS and HTML, while googling I found an amazing tool. There you can edit CSS3, HTML5 and JavaScript. Not only JavaScript, we can load other popular libs like jQuery, mootools, dojo etc. You can use their API on your site. <a title="jsFiddle - Online Editor for the Web (JavaScript, MooTools, jQuery, Prototype, YUI, Glow and Dojo, HTML, CSS)" href="http://http://jsfiddle.net/" target="_blank">JsFiddle </a>is a playground for web developers, a tool which may be used in many ways. <span id="more-2652"></span>One can use it as an online editor for snippets build from HTML, CSS and JavaScript. The code can then be shared with others, embedded on a blog, etc.</p>
<p>I&#8217;m very much curious about the flow/working of the tool, so  I did <a title="MouseOver Auto Scroller Menu Using jQuery and CSS" href="http://articles.tutorboy.com/2010/10/05/mouseover-auto-scroller-menu-using-jquery-and-css/" target="_blank">MouseOver Auto Scroller Menu Using jQuery and CSS</a> in  <a href="http://jsfiddle.net/Xr9Ua/1/" target="_blank">Here you find the codes in JsFiddle</a>. The screens gives you the steps which I followed.</p>
<p>&nbsp;</p>
<div id="attachment_2660" class="wp-caption alignnone" style="width: 374px"><a rel="attachment wp-att-2660" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-screen1/"><img class="size-medium wp-image-2660" title="jsfiddle.screen1" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.screen1-300x261.png" alt="" width="364" height="315" /></a><p class="wp-caption-text">Editor Window</p></div>
<p>&nbsp;</p>
<div id="attachment_2658" class="wp-caption alignleft" style="width: 178px"><a rel="attachment wp-att-2658" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-javascript-select-screen3/"><img class="size-medium wp-image-2658" title="jsfiddle.javascript.select.screen3" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.javascript.select.screen3-168x300.png" alt="" width="168" height="300" /></a><p class="wp-caption-text">Choosing JavaScript libs</p></div>
<div id="attachment_2655" class="wp-caption alignleft" style="width: 178px"><a rel="attachment wp-att-2655" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-adding-other-resource-screen4/"><img class="size-medium wp-image-2655" title="jsfiddle.adding.other.resource.screen4" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.adding.other_.resource.screen4-168x300.png" alt="" width="168" height="300" /></a><p class="wp-caption-text">Adding external resource files</p></div>
<div id="attachment_2656" class="wp-caption alignleft" style="width: 403px"><a rel="attachment wp-att-2656" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-complete-screen7/"><img class="size-medium wp-image-2656" title="jsfiddle.complete.screen7" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.complete.screen7-300x261.png" alt="" width="393" height="341" /></a><p class="wp-caption-text">The Editor View</p></div>
<div id="attachment_2659" class="wp-caption alignleft" style="width: 409px"><a rel="attachment wp-att-2659" href="http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/jsfiddle-result-screen5/"><img class="size-medium wp-image-2659" title="jsfiddle.result.screen5" src="http://articles.tutorboy.com/content/uploads/2011/03/jsfiddle.result.screen5-300x146.png" alt="" width="399" height="194" /></a><p class="wp-caption-text">Result </p></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Hope you would enjoy this tool.<br />
 <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2011/03/04/jsfiddle-an-online-editor-for-javascripts-html5-and-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Page Overlay using jQuery and CSS</title>
		<link>http://articles.tutorboy.com/2010/10/12/simple-page-overlay-using-jquery-and-css/</link>
		<comments>http://articles.tutorboy.com/2010/10/12/simple-page-overlay-using-jquery-and-css/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 11:31:50 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery from scratch]]></category>
		<category><![CDATA[Js]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2546</guid>
		<description><![CDATA[Simple script for page overlay using jQuery and CSS property. It will place a div after the body tag, and ...]]></description>
			<content:encoded><![CDATA[<p>Simple script for page overlay using jQuery and CSS property. It will place a <strong>div </strong>after the <strong>body </strong>tag, and apply fadeIn animation for the smoothing effect. Once the page overlay div is visible, by clicking on the fade in area you can be remove the overlay. Here is the code.<span id="more-2546"></span></p>
<h2>jQuery</h2>
<pre class="brush:js">$(document).ready(function(){

    // Appedning the overlay div
    $('body').append('&lt;div id="fadeOverlay" style="opacity:0.80;display:none;position:fixed;left:0;top:0;width:100%;height:100%;z-index:9999;background:#000;"&gt;&lt;/div&gt;');
    // Apply fadeIn animation for the smoothing effect.
    $('#fadeOverlay').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
    // Remove the overlay div when clicking on the fade in area.
    $('#fadeOverlay').click(function() {
        $(this).fadeOut("slow", function() {$(this).remove();});
    });

});</pre>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/10/12/simple-page-overlay-using-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MouseOver Auto Scroller Menu Using jQuery and CSS</title>
		<link>http://articles.tutorboy.com/2010/10/05/mouseover-auto-scroller-menu-using-jquery-and-css/</link>
		<comments>http://articles.tutorboy.com/2010/10/05/mouseover-auto-scroller-menu-using-jquery-and-css/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 06:03:05 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Auto Scroller Menu]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jquery Listing]]></category>
		<category><![CDATA[Jquery Menu]]></category>
		<category><![CDATA[Js]]></category>
		<category><![CDATA[Menus]]></category>
		<category><![CDATA[MouseOver]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2524</guid>
		<description><![CDATA[On Mouse Over auto stroller menu using  jQuery and CSS. The menu is build with ul li elements, menus are ...]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://articles.tutorboy.com/jquery/mouseover-auto-scroller-menu-using-jquery-and-css.html"><img class="alignright size-full wp-image-2528" title="auto_slider_menu" src="http://articles.tutorboy.com/content/uploads/2010/10/auto_slider_menu.jpg" alt="auto slider menu image" width="286" height="144" /></a>On Mouse Over auto stroller menu using  jQuery and CSS. The menu is build with <em><strong>ul li</strong></em> elements, menus are arranged on a menu_holder div and it will shows only a limited number of menus at the menu area. Rest of them are visible while mouse move on the menu area. <span id="more-2524"></span>All the menus will slide top to bottom, and bottom-top according to the up and downward movement of the mouse. The scroll function enabled only when the height of the ul li greater than the menu holder.</p>
<p><a class="wp-caption" href="http://articles.tutorboy.com/content/mouseover-auto-scroller-menu-using-jquery-and-css.html" target="_self">View Demo</a> <a class="wp-caption" href="http://downloads.tutorboy.com/articles/jquery_mouseover_auto_scroller.zip" target="_self">Download Source<br />
</a></p>
<h2>CSS</h2>
<pre class="brush:css">&lt;style&gt;
body{font: normal normal normal 15px/normal arial, sans-serif;margin:0 auto;}
#container{
	width:250px; /* Width and Height you can change */
	height:108px; /* Height of the menu container, 4 li elements, each li have 27px height so total 108*/
	padding:10px;
	border:1px solid #ccc;
	border-radius : 5px;
	-moz-border-radius : 5px;
	-webkit-border-radius : 5px;
	background:#CCC;
	font-family: sans-serif, Verdana, Arial;
	margin:0 auto;
}
#menu_holder{
	margin:0;
	padding:0;
	background:#FFF;
	overflow:hidden; /* make the overflow as hidden, like a mask layer*/
	height:108px; /* Height of the menu holder, same as the container*/
	position:fixed;
	width:250px;
}
#slider {
	list-style-type:none;
	margin:0;
	padding:0;
	position:absolute;
	width:250px;
}
#slider li{
	background:#0FF;
	padding:3px;
	border-bottom:1px solid #262626;
	background : #000;
	color:#92B3DE;
	text-align:center;
}
#slider li:hover{
	color:#FFF;
	background:#2A2A2A;
	cursor:pointer;
}
&lt;/style&gt;</pre>
<h2>HTML</h2>
<p>The Menu holder contains all the menu items. We set the holder <strong>height </strong>as a fixed(but you can change) , from my example I set it as 108px so I can accommodate 4 menus in the menu holder. Each menu having 27px height and total 27&#215;5 = 108. If you wanna include more menus inside the holder just calculate the height with your <strong>li&#8217;</strong>s height.  Set the <strong>menu holder</strong> div&#8217;s <strong>overflow </strong>property as <strong>hidden</strong>, so that if the menu height increases then the rest of the entries will not shown, that is the logic behind. By moving mouse over to the menu holder the <strong>slider </strong>div&#8217;s <strong>top</strong> value will increase and decrease by the up/down mouse movement.  The menu holder will act as a mask layer over the <strong>UL LI</strong>. So it smoothly slide inside the menu_holder div <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush:html">&lt;div id="container"&gt;
    &lt;div id="menu_holder"&gt;
        &lt;ul id="slider"&gt;
            &lt;li&gt;Menu Content 1&lt;/li&gt;
            &lt;li&gt;Menu Content 2&lt;/li&gt;
            &lt;li&gt;Menu Content 3&lt;/li&gt;
            &lt;li&gt;Menu Content 4&lt;/li&gt;
            &lt;li&gt;Menu Content 5&lt;/li&gt;
            &lt;li&gt;Menu Content 6&lt;/li&gt;
            &lt;li&gt;Menu Content 7&lt;/li&gt;
            &lt;li&gt;Menu Content 8&lt;/li&gt;
            &lt;li&gt;Menu Content 9&lt;/li&gt;
            &lt;li&gt;Menu Content 10&lt;/li&gt;
            &lt;li&gt;Menu Content 11&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Then you need <a href="http://code.google.com/apis/libraries/devguide.html#jquery">jQuery </a>lib file and jQuery easing plugin file. Download the easing plugin from <a href="http://gsgd.co.uk/sandbox/jquery/easing/">here</a>. The easing plug-in is optional, if you don&#8217;t want to use the easing effect try the commented code inside the script section.</p>
<h2>JavaScript Files</h2>
<pre class="brush:js">&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="jquery.easing.1.3.js"&gt;&lt;/script&gt;</pre>
<h2>jQuery</h2>
<p>Here is the complete script for the slider function. We trigger the mouse event for the menu holder div, and calculate the offset Y of the menu holder from the current mouse Y. And finally apply the values into the equation. <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush:js">$(document).ready(function() {
	// hover color change effect
	$("#slider li").hover(function() {
		$(this).animate({opacity: 0.90}, 100, function(){
			$(this).animate({opacity: 1}, 0);
		} );
	});
	// Trigger mouse move event over the 'menu_holder'.
	$("#menu_holder").mousemove(function(e) {
		// Enable scroll function only when the height of the 'slider' or menu is greater than the 'menu_holder'.
		if($(this).height() &lt; $("#slider").height()) {
			// Calculate the distance value from the 'menu_holder' y pos and page Y pos.
			var distance = e.pageY - $(this).offset().top;
			// Get the percentage value with respect to the Mouse Y on the 'menu_holder'.
			var percentage = distance / $(this).height();
			// Calculate the new Y position of the 'slider'.
			var targetY = -Math.round(($("#slider").height() - $(this).height()) * percentage);
			// With jQuery easing funtion from easing plugin.
			$('#slider').animate({top: [targetY+"px", "easeOutCirc"]}, { queue:false, duration:200 });
			// Without easeing function. by default jQuery have 'swing'.
			//$('#slider').animate({top: [targetY+"px", "easeOutCirc"]}, { queue:false, duration:200 });
		}
	});
});</pre>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/10/05/mouseover-auto-scroller-menu-using-jquery-and-css/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>XPath in JavaScript, PHP, ActionScript and jQuery</title>
		<link>http://articles.tutorboy.com/2010/09/27/xpath-in-javascript-php-actionscript-and-jquery/</link>
		<comments>http://articles.tutorboy.com/2010/09/27/xpath-in-javascript-php-actionscript-and-jquery/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 06:30:15 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Action Script 2.0]]></category>
		<category><![CDATA[Action Script 3.0]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Flash Component]]></category>
		<category><![CDATA[Flash CS3]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery from scratch]]></category>
		<category><![CDATA[Js]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2497</guid>
		<description><![CDATA[XPath, the XML Path Language, is a query language for selecting nodes from an XML document or we can say ...]]></description>
			<content:encoded><![CDATA[<p><strong>XPath</strong>, the <strong>XML Path Language</strong>, is a query language for selecting nodes from an XML document or we can say XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer. It also provides basic facilities for manipulation of strings, numbers and Boolean. Most of the languages were support this feature, if you didn&#8217;t find in respected language you will get from 3rd party libs. Here are some quick reference links to XPath &amp; XPath Libs.<span id="more-2497"></span></p>
<h1>Reference Links</h1>
<p>1. <a title="XPath Syntax" href="http://www.w3schools.com/XPath/xpath_syntax.asp" target="_blank">XPath Syntax</a></p>
<p>2. <a title="XML Path Language (XPath)" href="http://www.w3.org/TR/xpath/" target="_blank">XML Path Language (XPath)</a></p>
<p>3. <a title="XPath Examples .NET Framework 4" href="http://msdn.microsoft.com/en-us/library/ms256086.aspx" target="_blank">XPath Examples .NET Framework 4</a></p>
<p>4. <a title="Introduction to using XPath in JavaScript" href="https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript" target="_blank">Introduction to using XPath in JavaScript</a></p>
<p>5. <a title="An XPath implementation for ActionScript 3.0. " href="http://code.google.com/p/xpath-as3/" target="_blank">An XPath implementation for ActionScript 3.0. </a></p>
<p>6. <a title="PHP XPath Tutorial " href="http://ditio.net/2008/12/01/php-xpath-tutorial-advanced-xml-part-1/" target="_blank">PHP XPath Tutorial </a></p>
<p>7. <a title="jQuery  XPath Selectors" href="http://docs.jquery.com/DOM/Traversing/Selectors" target="_blank">jQuery  XPath Selectors</a></p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/09/27/xpath-in-javascript-php-actionscript-and-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>jQuery Notification Message like StackOverflow</title>
		<link>http://articles.tutorboy.com/2010/09/10/jquery-notification-message-like-stackoverflow/</link>
		<comments>http://articles.tutorboy.com/2010/09/10/jquery-notification-message-like-stackoverflow/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 10:47:28 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Js]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2423</guid>
		<description><![CDATA[Here is the source code of the notification message like in stackoverflow. Make it easy with jQuery  and CSS. Place ...]]></description>
			<content:encoded><![CDATA[<p>Here is the source code of the notification message like in stackoverflow. Make it easy with jQuery  and CSS. Place all your notification messages inside a div and apply CSS propertie<a href="../jquery/jquery-notification-message-like-stackoverflow.html"><img class="size-full wp-image-2426 alignright" title="Notification" src="../content/uploads/2010/09/Notification.jpg" alt="" width="315" height="109" /></a>s <code>position:fixed;top:0px;left:0px; </code> And place the close button with the span and a elements. <span id="more-2423"></span>&lt;span&gt;&lt;a title=&#8221;dismiss this notification&#8221;&gt;x&lt;/a&gt;&lt;/span&gt;. Hide the div element <code>display: none;</code>. and use jQuery to apply fadeIn and fadeOut. <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><a class="wp-caption" href="http://articles.tutorboy.com/content/jquery-notification-message.html" target="_blank">View Demo</a></p>
<h2>HTML</h2>
<pre class="brush:html">&lt;div id="notification" style="display: none;"&gt;
 Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
 &lt;span class="dismiss"&gt;&lt;a title="dismiss this notification"&gt;x&lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;</pre>
<h2>CSS</h2>
<pre class="brush:css">#notification {
    font-family:Arial,Helvetica,sans-serif;
    position:fixed;
    top:0px;
    left:0px;
    width:100%;
    z-index:105;
    text-align:left;
    font-weight:normal;
    font-size:100%;
    color:white;
    background-color:#000;
    padding:5px;
}
#notification span.dismiss {
    border:2px solid #FFF;
    padding:0 5px;
    cursor:pointer;
    float:right;
    margin-right:10px;
}
#notification a {
    color:white;
    text-decoration:none;
    font-weight:bold
}</pre>
<h2>jQuery</h2>
<pre class="brush:js">&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
$(document).ready(function() {
    $("#notification").fadeIn("slow");
    $(".dismiss").click(function(){
	$("#notification").fadeOut("slow");
    });
});</pre>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/09/10/jquery-notification-message-like-stackoverflow/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Detect iPod, iPad and iPhone Using JavaScript</title>
		<link>http://articles.tutorboy.com/2010/09/08/detect-ipod-ipad-iphone-using-javascript/</link>
		<comments>http://articles.tutorboy.com/2010/09/08/detect-ipod-ipad-iphone-using-javascript/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 11:54:09 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Js]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2401</guid>
		<description><![CDATA[JavaScript code to detect the user-agents of iPhone, iPad or iPod.
if (/iPad&#124;iPod&#124;iPhone/.test(navigator.userAgent)){
	// do ur stuffs for apple
}else{
	// do ur stuffs ...]]></description>
			<content:encoded><![CDATA[<p>JavaScript code to detect the user-agents of iPhone, iPad or iPod.</p>
<pre class="brush:js">if (/iPad|iPod|iPhone/.test(navigator.userAgent)){
	// do ur stuffs for apple
}else{
	// do ur stuffs for other browsers
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/09/08/detect-ipod-ipad-iphone-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Include js files inside a js file</title>
		<link>http://articles.tutorboy.com/2010/09/06/include-js-files-inside-a-js-file/</link>
		<comments>http://articles.tutorboy.com/2010/09/06/include-js-files-inside-a-js-file/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 05:50:14 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Js]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2383</guid>
		<description><![CDATA[Some times you want to include or load other .js files inside another .js files or on document. JavaScript doesn&#8217;t ...]]></description>
			<content:encoded><![CDATA[<p>Some times you want to include or load other .js files inside another .js files or on document. JavaScript doesn&#8217;t have any function to <code>include </code>any external js files. Writing script tag each time to DOM is not a good practice. Here the solution to load the script tag inside the head.<span id="more-2383"></span></p>
<h2>JavaScript</h2>
<pre class="brush:js">var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'externalScriptFile.js';
document.getElementsByTagName("head")[0].appendChild(script);
</pre>
<p>Use the above JavaScript code inside your body or .js file. The <code>script.src</code> is the file name which you want to load and the script will append to the <code>head</code> tag. If you have to load more files like this, just copy paste this into a function body.</p>
<h2>JavaScript</h2>
<pre class="brush:js">function include(jsFile) {
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = jsFile;
	document.getElementsByTagName("head")[0].appendChild(script);
}
include('externalScriptFile1.js');
include('externalScriptFile2.js');
</pre>
<p><strong>W</strong>ell you are done with that, now just read something about the <code>script </code>tag in <code>HTML</code>. The script tag is used to load or run scripts HTML, we use mainly 3 attributes for the script. No need to use the commenting(&lt;!&#8211; //&#8211;&gt;) tags inside the script tag, that is for the first generation browsers <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  to prevent scripts from showing up as text.</p>
<p>Script tag to load the script file</p>
<pre class="brush:js">&lt;script src="filename.js" type="text/javascript"&gt;&lt;/script&gt;
</pre>
<p>You should not write any codes inside the script tags when its use to load any file(s). Because if the <code>src</code> is present the script tag will considered as a load process. So any script inside that will not execute. But you can use the script with-out <code>src</code> will help you to execute the script.<br />
Script tag to execute the script</p>
<pre class="brush:js">&lt;script type="text/javascript"&gt;document.write("Hello World!!!");&lt;/script&gt;
</pre>
<h2>Attributes</h2>
<p><strong>src </strong>:  This attribute specifies the location of an external script.<br />
<strong>type </strong>:  This attribute specifies the scripting language of the element&#8217;s contents and overrides<br />
the default scripting language. The scripting language is specified as a content type<br />
(e.g., &#8220;text/javascript&#8221;). Authors must supply a value for this attribute.<br />
There is no default value for this attribute.<br />
<strong>defer </strong>:  When set, this boolean attribute provides a hint to the user agent that the script<br />
is not going to generate any document content (e.g., no &#8220;document.write&#8221; in javascript)<br />
and thus, the user agent can continue parsing and rendering.<br />
<strong>language </strong>: This attribute specifies the scripting language of the contents of this element.<br />
Its value is an identifier for the language, but since these identifiers are<br />
not standard, this attribute has been <em><strong>deprecated </strong></em>in favor of type.<br />
Reference: <a href="http://www.w3.org/TR/REC-html40/interact/scripts.html" target="_blank">http://www.w3.org/TR/REC-html40/interact/scripts.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/09/06/include-js-files-inside-a-js-file/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>jQuery UI DatePicker Disable/Enable Specified Dates</title>
		<link>http://articles.tutorboy.com/2010/09/03/jquery-ui-datepicker-disable-specified-dates/</link>
		<comments>http://articles.tutorboy.com/2010/09/03/jquery-ui-datepicker-disable-specified-dates/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 21:40:11 +0000</pubDate>
		<dc:creator>Midhun Devasia</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Date Picker]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery from scratch]]></category>
		<category><![CDATA[Js]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[UI-DatePicker]]></category>

		<guid isPermaLink="false">http://articles.tutorboy.com/?p=2346</guid>
		<description><![CDATA[We all are familiar with jQuery UI DatePicker, it have many options to customize the functionality. Instead of that we ...]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://articles.tutorboy.com/jquery/jquery-ui-datepicker-disable-specified-dates.html"><img class="alignright size-full wp-image-2361" title="ui-datepicker-disable-specified-dates" src="http://articles.tutorboy.com/content/uploads/2010/09/ui-datepicker-disable-specified-dates.jpg" alt="" width="369" height="181" /></a>We all are familiar with jQuery UI DatePicker, it have many options to customize the functionality. Instead of that we can be able to use or modify some of the values/params. Some times we want to disable/enable some days in datepicker, jQuery doesn&#8217;t  have <span id="more-2346"></span>any direct optional values for that. Here I&#8217;m mentioning the usage of <strong>beforeShowDay </strong>param<strong> </strong>in datepicker. The basic usage of the datepicker is <em>$(selector).datepicker();</em><strong> </strong>if<strong> </strong>you want to use params then <em>$(&#8216;#datepicker&#8217;).datepicker({minDate: new Date(2010, 10, 27), dateFormat: &#8216;mm/dd/yy&#8217;,}); </em><strong>beforeShowDay</strong> param will accept the a function and it pass each date to the function before its shown to the UI datepicker panel. So if the function return true then the date will active otherwise its disabled. <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  by the help of this params we can enable or disable the dates. You can use some of the simple methods which I&#8217;m gonna describe below.</p>
<p style="text-align: justify;"><a class="wp-caption" href="http://articles.tutorboy.com/content/jquery_ui_datepicker_disable_specified_dates.php" target="_blank">View Demo</a></p>
<h2>jQuery files</h2>
<pre class="brush:js">&lt;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;</pre>
<h2>Simple datepicker</h2>
<pre class="brush:js">$("#datepicker").datepicker();</pre>
<h2>Disable all dates till today</h2>
<pre class="brush:js">// get the current date
var date = new Date();
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();

// Disable all dates till today
$('#datepicker2').datepicker({
		minDate: new Date(y, m, d),
		dateFormat: 'mm-dd-yy',
});</pre>
<h2>Disable all dates from today</h2>
<pre class="brush:js">// Disable all dates from today
$('#datepicker3').datepicker({
		maxDate: new Date(y, m, d),
		dateFormat: 'mm-dd-yy',
});</pre>
<h2>Disable all weekends</h2>
<pre class="brush:js">// Disable all weekends
$('#datepicker4').datepicker({
		dateFormat: 'mm-dd-yy',
		beforeShowDay: $.datepicker.noWeekends
});</pre>
<h2>Disable a list of dates</h2>
<pre class="brush:js">// Disable a list of dates
var disabledDays = ["9-21-2010", "9-24-2010", "9-27-2010", "9-28-2010", "9-3-2010", "9-17-2010", "9-2-2010", "9-3-2010", "9-4-2010", "9-5-2010"];
function disableAllTheseDays(date) {
	var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
	for (i = 0; i &lt; disabledDays.length; i++) {
		if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1) {
			return [false];
		}
	}
	return [true];
}
$('#datepicker5').datepicker({
		dateFormat: 'mm-dd-yy',
		beforeShowDay: disableAllTheseDays
});</pre>
<h2>Enable a list of dates</h2>
<pre class="brush:js">// Enable a list of dates
var enabledDays = ["9-21-2010", "9-24-2010", "9-27-2010", "9-28-2010", "9-3-2010", "9-17-2010", "9-2-2010", "9-3-2010", "9-4-2010", "9-5-2010"];
function enableAllTheseDays(date) {
	var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
	for (i = 0; i &lt; enabledDays.length; i++) {
		if($.inArray((m+1) + '-' + d + '-' + y,enabledDays) != -1) {
			return [true];
		}
	}
	return [false];
}
$('#datepicker6').datepicker({
		dateFormat: 'mm-dd-yy',
		beforeShowDay: enableAllTheseDays
});</pre>
<h2>Disable a range of dates</h2>
<pre class="brush:js">// Disable a range of dates
var disabledDaysRange = [["9-1-2010 to 9-6-2010", "9-10-2010 to 9-15-2010", "10-27-2010 to 10-30-2010"], '9-17-2010'];
function disableRangeOfDays(d) {
	for(var i = 0; i &lt; disabledDaysRange.length; i++) {
		if($.isArray(disabledDaysRange[i])) {
			for(var j = 0; j &lt; disabledDaysRange[i].length; j++) {
				var r = disabledDaysRange[i][j].split(" to ");
				r[0] = r[0].split("-");
				r[1] = r[1].split("-");
				if(new Date(r[0][2], (r[0][0]-1), r[0][1]) &lt;= d &amp;&amp; d &lt;= new Date(r[1][2], (r[1][0]-1), r[1][1])) {
					return [false];
				}
			}
		}else{
			if(((d.getMonth()+1) + '-' + d.getDate() + '-' + d.getFullYear()) == disabledDaysRange[i]) {
				return [false];
			}
		}
	}
	return [true];
}
$('#datepicker7').datepicker({
		dateFormat: 'mm-dd-yy',
		beforeShowDay: disableRangeOfDays
});</pre>
<h2>Enable a range of dates</h2>
<pre class="brush:js'">// Enable a range of dates
var disabledDaysRange = [["9-1-2010 to 9-6-2010", "9-10-2010 to 9-15-2010", "10-27-2010 to 10-30-2010"], '9-17-2010'];
function disableRangeOfDays(d) {
	for(var i = 0; i &lt; disabledDaysRange.length; i++) {
		if($.isArray(disabledDaysRange[i])) {
			for(var j = 0; j &lt; disabledDaysRange[i].length; j++) {
				var r = disabledDaysRange[i][j].split(" to ");
				r[0] = r[0].split("-");
				r[1] = r[1].split("-");
				if(new Date(r[0][2], (r[0][0]-1), r[0][1]) &lt;= d &amp;&amp; d &lt;= new Date(r[1][2], (r[1][0]-1), r[1][1])) {
					return [true];
				}
			}
		}else{
			if(((d.getMonth()+1) + '-' + d.getDate() + '-' + d.getFullYear()) == disabledDaysRange[i]) {
				return [true];
			}
		}
	}
	return [false];
}

$('#datepicker8').datepicker({
		dateFormat: 'mm-dd-yy',
		beforeShowDay: disableRangeOfDays
});</pre>
<h2>Enable only Friday</h2>
<pre class="brush:js'">// Enable only Friday
$("#datepicker9").datepicker({
	dateFormat: 'dd-mm-yy',
	minDate: 1,
	beforeShowDay: enableFirday
});
// Custom function to enable friday only in jquery calender
function enableFirday(date) {
	var day = date.getDay();
	return [(day == 5), ''];
}</pre>
<p>Note: All the above function works well with the dateformat <em><strong>mm-dd-yy</strong></em>. But you can change the values in the function mainly in this line <strong>(m+1) + &#8216;-&#8217; + d + &#8216;-&#8217; + y</strong>. Replace the &#8211; with your char usage the same dateformat in all the arrays and functions. Have fun <img src='http://articles.tutorboy.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://articles.tutorboy.com/2010/09/03/jquery-ui-datepicker-disable-specified-dates/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

