<?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>ABCoder &#187; Core JavaScript</title>
	<atom:link href="http://abcoder.com/topics/javascript/core_javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://abcoder.com</link>
	<description>ABCoder - Coding is Simple as A b c</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:45:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>IE6 fix for select box over absolute positioned element</title>
		<link>http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/</link>
		<comments>http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 11:07:36 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[absolute]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[drop down menu]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[internet explorer 6]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[ul]]></category>
		<category><![CDATA[windowed element]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=129</guid>
		<description><![CDATA[The detailed instruction with css and jquery code for drop down menu over select box - fix for ie6.


Related posts:<ol><li><a href='http://abcoder.com/javascript/jquery/jquery-drop-down-menu-without-settimeout/' rel='bookmark' title='Permanent Link: jQuery Drop down menu without setTimeout'>jQuery Drop down menu without setTimeout</a> <small>jQuery drop down menu without using setTimeout function of javascript. It uses the magic of jQuery's hover function. The magical thing happens when the hover function is called inside another hover function with first function to null. So the menu doesn't hide and so no need to use the setTimeout. It's a very smart solution in the "jQuery way"!...</small></li>
<li><a href='http://abcoder.com/javascript/a-better-process-to-find-maximum-z-index-within-a-page/' rel='bookmark' title='Permanent Link: A better process to find maximum z-index within a page'>A better process to find maximum z-index within a page</a> <small>A jQuery approach to find the maximum z-index of an element in DOM. You'll find it helpful and handy for your complex javascript application when you need to handle the absolute positioned message windows layers or similar cases....</small></li>
<li><a href='http://abcoder.com/css/css-equal-height-columns/' rel='bookmark' title='Permanent Link: CSS Equal Height Columns'>CSS Equal Height Columns</a> <small>Pure CSS three columns equal height hack with and without background image, bottom border fix and many more. Please go through the full article for different phenomena of div based multi-columns layout with free html, jQuery, javascript, css source code and images....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>IE6 sux. General css/javascript hover drop-down menu uses a div or ul with position:absolute. No matter how much you increase the value of z-index the select box (windowed element) will always remain on top most &#8211; yes only on a special browser, Internet Explorer 6. The reason is IE6 considers select element as windowed element and keeps it always on top layer. </p>
<p><img src="http://abcoder.com/images/select-box-over-div-ie6.jpg" alt="IE6 select box over div " /></p>
<p>Solution is using iframe on top of select element, as iframe is also a windowed element placing it on top of select box fix the problem.</p>
<p><img src="http://abcoder.com/images/select-box-over-div-ie6-fixed.jpg" alt="IE6 select box over div prob fixed using iframe" /></p>
<p>Here is the typical HTML code for this drop-down menu:</p>
<pre class="brush: xml;">&lt;div class=&quot;top-menus&quot; style=&quot;left: 221px; top: 127px;&quot;&gt;
&lt;iframe frameborder=&quot;0&quot; scrolling=&quot;no&quot; align=&quot;bottom&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; src=&quot;javascript:'';&quot; style=&quot;height: 200px;&quot;&gt;&lt;/iframe&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Bracelets&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Rings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Earrings&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Necklaces&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</pre>
<p>The inline css is calculated using jQuery offset() function. FYI, you can easily get the width,height,left,top position of any element using jQuery(&#8220;element&#8221;).offset(). Make sure the width and height of the iframe is exactly same of it&#8217;s overlying UL element. If you apply any border to the UL, you have to consider that during calculating the proper width/height of the iframe.</p>
<p>This is the sample jQuery code:</p>
<pre class="brush: jscript;">var timer = null; // global
$(&quot;#top-nav a&quot;).hover(function(){
	clearTimeout(timer);
	$(&quot;#top-nav a:not('.cur')&quot;).removeClass(&quot;selected&quot;);
	$(this).addClass(&quot;selected&quot;);

	var o = $(this).offset();
	var left = o.left + 1; // 1px extra for border
	var top = o.top + 32; // 32px for placing it just below the horizontal menu
	if($(&quot;.top-menus&quot;).length){
		if(left == $(&quot;.top-menus&quot;).offset().left)
			return;
		else $(&quot;.top-menus&quot;).remove();
	}

	$(&quot;body&quot;).prepend('&lt;div style=&quot;left:'+left+'px;top:'+top+'px;&quot; class=&quot;top-menus&quot;&gt;&lt;iframe src=&quot;javascript:\'\';&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; align=&quot;bottom&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;&lt;ul&gt;'+html+'&lt;/ul&gt;&lt;/div&gt;');
		$(&quot;.top-menus&quot;).find(&quot;.parent, .child&quot;).remove();
		var hi = $(&quot;.top-menus&quot;).find(&quot;ul&quot;).height();
		$(&quot;iframe&quot;).height(hi + 2); // extra 2px for border

}, function(){
	clearTimeout(timer);
	timer = setTimeout(function(){$(&quot;body&quot;).find(&quot;iframe,.top-menus&quot;).remove(); $(&quot;#top-nav a:not('.cur')&quot;).removeClass(&quot;selected&quot;);},300);
});

$(&quot;.top-menus&quot;).live(&quot;mouseover&quot;,function(){
	clearTimeout(timer);
}).live(&quot;mouseout&quot;,function(){
	clearTimeout(timer);
	timer = setTimeout(function(){$(&quot;body&quot;).find(&quot;iframe,.top-menus&quot;).remove(); $(&quot;#top-nav a:not('.cur')&quot;).removeClass(&quot;selected&quot;);},300);
});</pre>
<p>I know this code won&#8217;t exactly fulfill your requirement, you can get the main idea from this and write your own code yourself. You can see it in action on <a href="http://www.trendtogo.com/">www.trendtogo.com</a>.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/jquery/jquery-drop-down-menu-without-settimeout/' rel='bookmark' title='Permanent Link: jQuery Drop down menu without setTimeout'>jQuery Drop down menu without setTimeout</a> <small>jQuery drop down menu without using setTimeout function of javascript. It uses the magic of jQuery's hover function. The magical thing happens when the hover function is called inside another hover function with first function to null. So the menu doesn't hide and so no need to use the setTimeout. It's a very smart solution in the "jQuery way"!...</small></li>
<li><a href='http://abcoder.com/javascript/a-better-process-to-find-maximum-z-index-within-a-page/' rel='bookmark' title='Permanent Link: A better process to find maximum z-index within a page'>A better process to find maximum z-index within a page</a> <small>A jQuery approach to find the maximum z-index of an element in DOM. You'll find it helpful and handy for your complex javascript application when you need to handle the absolute positioned message windows layers or similar cases....</small></li>
<li><a href='http://abcoder.com/css/css-equal-height-columns/' rel='bookmark' title='Permanent Link: CSS Equal Height Columns'>CSS Equal Height Columns</a> <small>Pure CSS three columns equal height hack with and without background image, bottom border fix and many more. Please go through the full article for different phenomena of div based multi-columns layout with free html, jQuery, javascript, css source code and images....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 png alpha transparency fix for dynamically loaded images via ajax</title>
		<link>http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/</link>
		<comments>http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 10:13:55 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax loading]]></category>
		<category><![CDATA[alpha]]></category>
		<category><![CDATA[dynamic image]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[iepngfix]]></category>
		<category><![CDATA[iepngfix.htc]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=66</guid>
		<description><![CDATA[Simple javascript and jQuery code for fixing the alpha transparency problem of png image on Internet explorer 6. iepngfix.htc does not work for dynamic images loaded via ajax call. But this simple code works great for dynamically loaded images.


Related posts:<ol><li><a href='http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/' rel='bookmark' title='Permanent Link: Using Dreamweaver Spry validation with jQuery ajax form plugin'>Using Dreamweaver Spry validation with jQuery ajax form plugin</a> <small>A simple function for using Spry form validation of Dreamweaver with jQuery ajax form submit plugin. Just put this 3 lines of code in the "beforeSubmit" parameter of $.ajaxForm and that's all!...</small></li>
<li><a href='http://abcoder.com/php/problem-with-resizing-corrupted-images-using-php-image-functions/' rel='bookmark' title='Permanent Link: Problem with resizing corrupted images using PHP image functions'>Problem with resizing corrupted images using PHP image functions</a> <small>PHP image functions can not resize corrupted image files. Use phpThumb for resizing images and you'll save a lot of time. Please read the full article for source code. Thanks again to phpThumb for their great effort!...</small></li>
<li><a href='http://abcoder.com/javascript/jquery/ajax-and-seo-is-it-possible-to-get-them-together/' rel='bookmark' title='Permanent Link: AJAX and SEO &#8211; Is it possible to get them together?'>AJAX and SEO &#8211; Is it possible to get them together?</a> <small>About 7 months ago I threw a question on LinkedIn, AJAX &amp; SEO. It was about is ajax seo friendly! (The website can be found here http://demo.zpbappi.com). Most of the people answered &#8220;NO&#8221;. All of them suggested me not to use 100% Ajax(ed) website as search endings do not render the javascript. The site has [...]...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>IE6 is always a nightmare for web developers. The most painful drawback is it does not support the alpha transparency of transparent png images and you know how to solve this problem using <a href="http://www.twinhelix.com/css/iepngfix/" title="IE6 png fix" rel="nofollow" target="_blank">iepngfix</a> or <a href="http://jquery.andreaseberhard.de/pngFix/" title="jQuery IE6 png fix" rel="nofollow" target="_blank">jquery.pngFix.js</a>.</p>
<p>You must be thinking.. what is new in my post then!! Have you ever used any of them for dynamic png images? Some people call it &#8220;Loading an image via ajax&#8221;. Let me explain what I mean by &#8220;dynamic png images&#8221;.. say you have a page where clicking on a link does not reload the page, but load a transparent/semitransparent png image. Most specifically, I was working on a <a href="http://www.wisedecor.com/" title="Wise Decor" rel="nofollow" target="_blank">project</a> where user types some text in a text box, it is converted to transparent png image on the fly using php and then it is displayed inside a div which has a graph-paper like background-image. This whole thing is done without reloading the page at all.</p>
<p>It looks okay on FF, safari, IE7 but on IE6 the transparent portion looks Grey. The iepngfix.htc script didn&#8217;t help, cos it only works on the images which are loaded and showed at the beginning of page loading. After the page is fully loaded and you load another png image using ajax this script won&#8217;t work. But I could not do that for my project as it is meant to be loaded dynamically using ajax for the sake of advanced user experience.</p>
<p>I started googling for it, no luck. Finally I modified a portion of code used in the iepngfix.htc file and fixed the problem using this simple javascript code. (FYI, I was using YUI so only the browser checking part is done using it, you can use jQuery or pure javascript for browser detection)</p>
<pre class="brush: jscript;">var textImage = new Image();
textImage.src = &quot;text.png&quot;; // src of the png image. okay if not ie6
if (YAHOO.env.ua.ie &gt; 5 &amp;&amp; YAHOO.env.ua.ie &lt; 7) { // if IE 5+ or 6 or 6+
    var timg_src = textImage.src;  // textImage
    var new_img = new Image();  // just as a preloader
    new_img.src = timg_src;

    new_img.onload = function(){ // remember, the image is being loaded dynamically, so apply the filter after it is loaded.
        var ti = document.getElementById(&quot;textImage&quot;); // the ID of the img tag where it'll be loaded
        ti.style.width = new_img.width; // you can get the width/height of image after it is fully loaded
        ti.style.height = new_img.height; // and you must &quot;DEFINE&quot; the image height/width. &quot;auto&quot; height/width won't work!

        // This is it. apply the filter :)
        ti.style.filter = &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader(src='&quot; + timg_src + &quot;', sizingMethod='scale')&quot;;
        ti.setAttribute('src', 'blank.gif'); // don't forget this part. the image src is replaced with a blank gif image.
    }
}</pre>
<p>Here is another version of the code which is not for dynamic images. It&#8217;s alternative of iepngfix.htc. In some cases you may not like using iepngfix.htc, rather want to control it yourself. For example if your page has hundreds of png images which are not transparent and only a few images that are transparent, in this case using iepngfix.htc will make the whole process too slow. I applied a pseudo class &#8220;png&#8221; to all png images &amp; divs with png background image with fixed height &amp; width and applied this simple jQuery code:</p>
<pre class="brush: jscript;">$(window).load(function(){ // after all the images are loaded
    if ($.browser.msie &amp;&amp; parseInt($.browser.version.substr(0, 1)) &lt; 7) { // ie6 or 5
        $(&quot;img.png&quot;).each(function(){
            $(this).css(&quot;filter&quot;, &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader(src='&quot; + $(this).attr('src') + &quot;', sizingMethod='scale')&quot;).attr(&quot;src&quot;, &quot;images/blank.gif&quot;);
        });
        $(&quot;div.png&quot;).each(function(){
            var bg = $(this).css(&quot;backgroundImage&quot;);
            bg.match(/^url[(&quot;']+(.*\.png)[)&quot;']+$/i);
            bg = RegExp.$1;
            $(this).css(&quot;filter&quot;, &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader(src='&quot; + bg + &quot;', sizingMethod='crop')&quot;).css(&quot;backgroundImage&quot;, &quot;none&quot;);
        });
    }
});</pre>
<p>Hope you&#8217;ll find it helpful. Please let me know if you have any better idea.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/' rel='bookmark' title='Permanent Link: Using Dreamweaver Spry validation with jQuery ajax form plugin'>Using Dreamweaver Spry validation with jQuery ajax form plugin</a> <small>A simple function for using Spry form validation of Dreamweaver with jQuery ajax form submit plugin. Just put this 3 lines of code in the "beforeSubmit" parameter of $.ajaxForm and that's all!...</small></li>
<li><a href='http://abcoder.com/php/problem-with-resizing-corrupted-images-using-php-image-functions/' rel='bookmark' title='Permanent Link: Problem with resizing corrupted images using PHP image functions'>Problem with resizing corrupted images using PHP image functions</a> <small>PHP image functions can not resize corrupted image files. Use phpThumb for resizing images and you'll save a lot of time. Please read the full article for source code. Thanks again to phpThumb for their great effort!...</small></li>
<li><a href='http://abcoder.com/javascript/jquery/ajax-and-seo-is-it-possible-to-get-them-together/' rel='bookmark' title='Permanent Link: AJAX and SEO &#8211; Is it possible to get them together?'>AJAX and SEO &#8211; Is it possible to get them together?</a> <small>About 7 months ago I threw a question on LinkedIn, AJAX &amp; SEO. It was about is ajax seo friendly! (The website can be found here http://demo.zpbappi.com). Most of the people answered &#8220;NO&#8221;. All of them suggested me not to use 100% Ajax(ed) website as search endings do not render the javascript. The site has [...]...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Dreamweaver Spry validation with jQuery ajax form plugin</title>
		<link>http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/</link>
		<comments>http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 13:30:26 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax form submit]]></category>
		<category><![CDATA[ajax submit]]></category>
		<category><![CDATA[click]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[submit]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=60</guid>
		<description><![CDATA[A simple function for using Spry form validation of Dreamweaver with jQuery ajax form submit plugin. Just put this 3 lines of code in the "beforeSubmit" parameter of $.ajaxForm and that's all!


Related posts:<ol><li><a href='http://abcoder.com/javascript/jquery/jquery-cycle-plugin-as-carousel/' rel='bookmark' title='Permanent Link: jQuery cycle plugin as carousel'>jQuery cycle plugin as carousel</a> <small>You can use the jQuery cycle plugin as carousel. No need of special plugin for carousel. Just use the fx: 'scrollHorz' and that's all! This option is kinda hidden on the malsup site. Don't know why they never emphasize on this option!!...</small></li>
<li><a href='http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/' rel='bookmark' title='Permanent Link: IE6 png alpha transparency fix for dynamically loaded images via ajax'>IE6 png alpha transparency fix for dynamically loaded images via ajax</a> <small>Simple javascript and jQuery code for fixing the alpha transparency problem of png image on Internet explorer 6. iepngfix.htc does not work for dynamic images loaded via ajax call. But this simple code works great for dynamically loaded images....</small></li>
<li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Writing form validation code manually is a boring task. Not only that, editing or adding new fields each time and modifying the validation code accordingly is such a pain. When Dreamweaver added the Spry form validation with CS3 the nightmare is over. The greatest feature of using it is you can do the form validation work automatically with a couple of mouse clicks and no hand written code! And you can easily change/edit or add/remove the fields.</p>
<p>I know jQuery has simple validation plugin but you have to write the codes for it, which is time consuming. I always use the spry validation of dreamweaver as I learned using it for it&#8217;s simplicity. When I tried to use it with the <a rel ="nofollow" href="http://malsup.com/jquery/form/" target="_blank">jQuery ajax form submit plugin</a> I got disappointed. It didn&#8217;t work! I didn&#8217;t stop trying. And finally I found the way which I&#8217;m gonna share with you :)</p>
<p>Here is the simple code that you need in the &#8220;beforeSubmit&#8221; parameter of $.ajaxForm</p>
<pre class="brush: jscript;">$(&quot;#formID&quot;).ajaxForm({
    url: &quot;submit.php&quot;,
    beforeSubmit: function(formData, jqForm, options){
        if (Spry) { // checks if Spry is used in your page
            var r = Spry.Widget.Form.validate(jqForm[0]); // validates the form
            if (!r)
                return r;
        }
    },
    success: successFunction,
    complete: completeFunction
});</pre>
<p>Hope that&#8217;ll help a lot boosting your web development.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/jquery/jquery-cycle-plugin-as-carousel/' rel='bookmark' title='Permanent Link: jQuery cycle plugin as carousel'>jQuery cycle plugin as carousel</a> <small>You can use the jQuery cycle plugin as carousel. No need of special plugin for carousel. Just use the fx: 'scrollHorz' and that's all! This option is kinda hidden on the malsup site. Don't know why they never emphasize on this option!!...</small></li>
<li><a href='http://abcoder.com/javascript/ie6-png-alpha-transparency-fix-for-dynamically-loaded-images-via-ajax/' rel='bookmark' title='Permanent Link: IE6 png alpha transparency fix for dynamically loaded images via ajax'>IE6 png alpha transparency fix for dynamically loaded images via ajax</a> <small>Simple javascript and jQuery code for fixing the alpha transparency problem of png image on Internet explorer 6. iepngfix.htc does not work for dynamic images loaded via ajax call. But this simple code works great for dynamically loaded images....</small></li>
<li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/using-dreamweaver-spry-validation-with-jquery-ajax-form-plugin/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Gmail uploader clone with drag drop feature : Free Download with source code</title>
		<link>http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/</link>
		<comments>http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/#comments</comments>
		<pubDate>Wed, 13 May 2009 16:12:19 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ajax form submit]]></category>
		<category><![CDATA[ajax image uploader]]></category>
		<category><![CDATA[ajax submit]]></category>
		<category><![CDATA[ajax uploader]]></category>
		<category><![CDATA[drag and drop]]></category>
		<category><![CDATA[drag drop]]></category>
		<category><![CDATA[dynamic file uploader]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[gmail file uploader]]></category>
		<category><![CDATA[gmail like image file uploader]]></category>
		<category><![CDATA[gmail uploader]]></category>
		<category><![CDATA[Uploader]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=31</guid>
		<description><![CDATA[Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free.


Related posts:<ol><li><a href='http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Flickr Uploader Clone: Free Download with source code'>Flickr Uploader Clone: Free Download with source code</a> <small>Flickr Uploader clone for free using javascript and flash. PHP is used for server side. Download if for completely free in one zip file....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/advanced-cycle-plugin-integration/' rel='bookmark' title='Permanent Link: Advanced cycle plugin integration'>Advanced cycle plugin integration</a> <small>Load only the current slide of a jQuery cycle plugin slideshow. For large size images slideshow, loading all the images at once highly affects the page loading time. Here is the technique to load one image once only before starting of the next slide. It'll definitely reduce the page loading time....</small></li>
<li><a href='http://abcoder.com/google/gmail-google/new-phonetic-keyboard-in-gmail/' rel='bookmark' title='Permanent Link: New Phonetic keyboard in Gmail'>New Phonetic keyboard in Gmail</a> <small>Phonetic keyboard inside is a new astonishing &amp; useful feature of Gmail. Currently it supports 12 languages including Bengali, Hindi, Arabic with rtl. It's really an appreciating step of gmail with due respect to mother-tongue of people around the world. Keep up the good work, thanks to Gmail....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Recently I developed the gmail file uploader clone using jQuery. Here is the online <a title="Gmail uploader clone with drag drop thumbnail feature" href="http://abcoder.com/Gmail-Uploader/" target="_blank"><strong>demo</strong></a>.</p>
<p><img src="http://abcoder.com/Gmail-Uploader/gmail-uploader-clone.jpg" alt="Gmail uploader clone with drag drop feature screen shot" width="500" height="211" /></p>
<p>I added some extra functionalists.<br />
You can see the image thumbnails after the uploading is completed. There is a cross button at top right of each thumbnail, clicking on it will delete the image. If you right click on the image you&#8217;ll see a context menu from which you can delete the image too along with replace the existing image option.</p>
<p>The most interesting feature is you can drag drop the thumbnails to change the order. Yes this is essential when you need to maintain the order of images in classified sites after uploading them, also a little modification will let you edit the image order later time by dragging the thumbnails. The image name and the image title is dynamically added in the &#8220;updateInfo&#8221; form and send(post) via the hidden fields imgs[] and imgComment[]  array. You can easily get the order by php using foreach loop on $_POST['imgs'] field. Just hit the submit button after uploading 2 images and you will see the output on post.php page. (hope that makes sense).</p>
<p><a title="Download gmail uploader clone with drag drop feature in a single zip file for absolutely free!" href="http://www.abcoder.com/Gmail-Uploader/Gmail-Uploader.zip" target="_blank"><strong>Download it for free in a single zip file</strong></a></p>
<p>If you have any better example of gmail uploader clone please share the links in comments.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Flickr Uploader Clone: Free Download with source code'>Flickr Uploader Clone: Free Download with source code</a> <small>Flickr Uploader clone for free using javascript and flash. PHP is used for server side. Download if for completely free in one zip file....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/advanced-cycle-plugin-integration/' rel='bookmark' title='Permanent Link: Advanced cycle plugin integration'>Advanced cycle plugin integration</a> <small>Load only the current slide of a jQuery cycle plugin slideshow. For large size images slideshow, loading all the images at once highly affects the page loading time. Here is the technique to load one image once only before starting of the next slide. It'll definitely reduce the page loading time....</small></li>
<li><a href='http://abcoder.com/google/gmail-google/new-phonetic-keyboard-in-gmail/' rel='bookmark' title='Permanent Link: New Phonetic keyboard in Gmail'>New Phonetic keyboard in Gmail</a> <small>Phonetic keyboard inside is a new astonishing &amp; useful feature of Gmail. Currently it supports 12 languages including Bengali, Hindi, Arabic with rtl. It's really an appreciating step of gmail with due respect to mother-tongue of people around the world. Keep up the good work, thanks to Gmail....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>A better process to find maximum z-index within a page</title>
		<link>http://abcoder.com/javascript/a-better-process-to-find-maximum-z-index-within-a-page/</link>
		<comments>http://abcoder.com/javascript/a-better-process-to-find-maximum-z-index-within-a-page/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 23:13:39 +0000</pubDate>
		<dc:creator>rahen</dc:creator>
				<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[get maximum z-index of a div]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[max z-index]]></category>
		<category><![CDATA[maximum z-index of a div]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[z-index]]></category>
		<category><![CDATA[zIndex]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=28</guid>
		<description><![CDATA[A jQuery approach to find the maximum z-index of an element in DOM. You'll find it helpful and handy for your complex javascript application when you need to handle the absolute positioned message windows layers or similar cases.


Related posts:<ol><li><a href='http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/' rel='bookmark' title='Permanent Link: IE6 fix for select box over absolute positioned element'>IE6 fix for select box over absolute positioned element</a> <small>The detailed instruction with css and jquery code for drop down menu over select box - fix for ie6....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/jquery-vs-prototypejs/' rel='bookmark' title='Permanent Link: jQuery vs. prototype.js'>jQuery vs. prototype.js</a> <small>I&#8217;m basically a jQuery developer. I had little knowledge about prototype.js. All I knew is jQuery is better than prototype, so I never got interested about it. However, for some reason I started a project with prototype.js and each line of code makes it clearer that which one is better. Somehow I finished the project [...]...</small></li>
<li><a href='http://abcoder.com/javascript/jquery/jquery-live-event/' rel='bookmark' title='Permanent Link: jQuery &#8220;live&#8221; event'>jQuery &#8220;live&#8221; event</a> <small>jQuery live event is a great new dynamic feature. You can assign live events to current elements in dom as well as it'll be automatically applied to newly created (future) elements. You do not need to bind the event each time after creating a new element again and again unlike bind event. It'll make your code clean and you'll get more time for dating :P...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Once I needed to get maximum z-index of a DIV to show message at the top of the screen.<br />
Usually, I used arbitrary z-index of 100 of the DIV. But that one is not at the top and it&#8217;s hidden by others.<br />
What&#8217;s wrong? And unfortunately I found that there are 3 more div-s which have z-index attribute which are greater than 100.<br />
So I changed the z-index to 1000. This time I can see one portion of the DIV.<br />
But 2 more elements get the desired message container DIV overlaid. Frustrating! Huh!<br />
Trial and error method always makes you delay.<br />
I know JavaScript or jQuery may get rid of this hell.<br />
I made an absolute tinny code to find the highest z-index of absolute DIV<br />
to show my shouting box and to make it appear absolutely at the top of all html elements.</p>
<pre class="brush: jscript;">//include jQuery.js --  visit: http://jquery.com/
$(function(){
    var maxZ = Math.max.apply(null,$.map($('body &gt; *'), function(e,n){
           if($(e).css('position')=='absolute')
                return parseInt($(e).css('z-index'))||1 ;
           })
    );
    alert(maxZ);
});</pre>
<p>I used selector of &#8221;<strong>body &gt; *</strong>&#8216; instead of &#8216;<strong>body *</strong>&#8216;.</p>
<p>&#8221;<strong>body &gt; *</strong>&#8216; means all tags/elements which are found at first depth of<br />
whether &#8221;<strong>body *</strong>&#8216; selects all tags/elements at any depth.<br />
It doesn&#8217;t matter what&#8217;s is the maximum/highest z-index of an absolute element<br />
rather it matters what&#8217;s the maximum/highest z-index of the absolute elements<br />
which are next to in first depth only to show the shouting box on top most strata.</p>
<p>N.B. Shouting box is appended to document.body  in this case.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/' rel='bookmark' title='Permanent Link: IE6 fix for select box over absolute positioned element'>IE6 fix for select box over absolute positioned element</a> <small>The detailed instruction with css and jquery code for drop down menu over select box - fix for ie6....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/jquery-vs-prototypejs/' rel='bookmark' title='Permanent Link: jQuery vs. prototype.js'>jQuery vs. prototype.js</a> <small>I&#8217;m basically a jQuery developer. I had little knowledge about prototype.js. All I knew is jQuery is better than prototype, so I never got interested about it. However, for some reason I started a project with prototype.js and each line of code makes it clearer that which one is better. Somehow I finished the project [...]...</small></li>
<li><a href='http://abcoder.com/javascript/jquery/jquery-live-event/' rel='bookmark' title='Permanent Link: jQuery &#8220;live&#8221; event'>jQuery &#8220;live&#8221; event</a> <small>jQuery live event is a great new dynamic feature. You can assign live events to current elements in dom as well as it'll be automatically applied to newly created (future) elements. You do not need to bind the event each time after creating a new element again and again unlike bind event. It'll make your code clean and you'll get more time for dating :P...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/a-better-process-to-find-maximum-z-index-within-a-page/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to get currently logged on windows username in PHP and Javascript</title>
		<link>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/</link>
		<comments>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 17:51:56 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[get currently logged on windows username]]></category>
		<category><![CDATA[get user]]></category>
		<category><![CDATA[get windows user name using javascript]]></category>
		<category><![CDATA[pull username]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[username]]></category>
		<category><![CDATA[VBscript]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows system variable]]></category>
		<category><![CDATA[windows username]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=23</guid>
		<description><![CDATA[Get current windows username in php and javascript! Is that possible?


Related posts:<ol><li><a href='http://abcoder.com/microsoft/windows-7-reduces-battery-life/' rel='bookmark' title='Permanent Link: Under Windows 7 laptop reduces more battery life'>Under Windows 7 laptop reduces more battery life</a> <small>Based on various forum posts, users are claiming that battery life running out very quickly after a laptop is upgraded from an older OS to Windows 7....</small></li>
<li><a href='http://abcoder.com/microsoft/windows-phone-7-cannot-run-applications-written-for-older-versions/' rel='bookmark' title='Permanent Link: Windows phone 7 cannot run applications written for older versions'>Windows phone 7 cannot run applications written for older versions</a> <small>Microsoft Corp. has said its new software for smart phones, Windows Phone 7 series, is a "clean break" with the past. But Windows phone 7 cannot run any applications written for older versions of Microsoft's phone software. Windows Phone 7 Series is designed for touch screens that work well with fingers but don't work with fine styluses....</small></li>
<li><a href='http://abcoder.com/javascript/core_javascript/javascript_timer/' rel='bookmark' title='Permanent Link: Javascript timer &#8211; advanced features, simple to use'>Javascript timer &#8211; advanced features, simple to use</a> <small>javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain [...]...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It is very simple to get the current windows username in PHP. The following one line of code will output the username of the system where the server is running. If you are running this from localhost then your system login name will be shown. But you can not get the visitor&#8217;s system login username.</p>
<pre class="brush: php;">&lt;?php echo getenv(&quot;username&quot;); ?&gt;</pre>
<p>By using javascript (actually VBscript) you can get the visitor&#8217;s windows username. But there are also limitations. It only works on IE.</p>
<pre class="brush: jscript;">&lt;script language=&quot;VBscript&quot;&gt;
Dim X
set X = createobject(&quot;WSCRIPT.Network&quot;)
dim U
U=x.UserName
MsgBox &quot;username: &quot; &amp; U
&lt;/script&gt;
&lt;script language=&quot;Javascript&quot;&gt;
var a = U;
alert(&quot;Hello, &quot; + a.toString());
&lt;/script&gt;</pre>
<p>This code will show you the current windows username. But won&#8217;t work if run from http://. Open the page from your computer with IE and it&#8217;ll work, otherwise not.</p>
<p>Actually it is not possible to get the windows username of your website visitors as it is a security issue. So don&#8217;t waste your time if you are trying to do that.</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/microsoft/windows-7-reduces-battery-life/' rel='bookmark' title='Permanent Link: Under Windows 7 laptop reduces more battery life'>Under Windows 7 laptop reduces more battery life</a> <small>Based on various forum posts, users are claiming that battery life running out very quickly after a laptop is upgraded from an older OS to Windows 7....</small></li>
<li><a href='http://abcoder.com/microsoft/windows-phone-7-cannot-run-applications-written-for-older-versions/' rel='bookmark' title='Permanent Link: Windows phone 7 cannot run applications written for older versions'>Windows phone 7 cannot run applications written for older versions</a> <small>Microsoft Corp. has said its new software for smart phones, Windows Phone 7 series, is a "clean break" with the past. But Windows phone 7 cannot run any applications written for older versions of Microsoft's phone software. Windows Phone 7 Series is designed for touch screens that work well with fingers but don't work with fine styluses....</small></li>
<li><a href='http://abcoder.com/javascript/core_javascript/javascript_timer/' rel='bookmark' title='Permanent Link: Javascript timer &#8211; advanced features, simple to use'>Javascript timer &#8211; advanced features, simple to use</a> <small>javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain [...]...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Flickr Uploader Clone: Free Download with source code</title>
		<link>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/</link>
		<comments>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 18:13:44 +0000</pubDate>
		<dc:creator>adnan</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[flash uploader]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Flickr Uploader]]></category>
		<category><![CDATA[Javascript uploader with progress bar]]></category>
		<category><![CDATA[Uploader]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=18</guid>
		<description><![CDATA[Flickr Uploader clone for free using javascript and flash. PHP is used for server side. Download if for completely free in one zip file.


Related posts:<ol><li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
<li><a href='http://abcoder.com/flickr/flicka-on-android-market-is-knocking-at/' rel='bookmark' title='Permanent Link: Flicka on Android Market is knocking at'>Flicka on Android Market is knocking at</a> <small>Flickr.com is going to introduce its aptitude through Flicka on Android phone....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have been searching for flickr uploader clone script online for one of my project. But no luck! There is no such thing on internet. Then I started with analyzing the javascript code of flickr uploader. Lucky that they did not packed their js. Though it was minified by removing white spaces. I used an online javascript code beautifier to make it pretty readable. After that the challenging part began. Cos, the code normally does not work on my local server. After huge hard working of long one week I made it finally. It works great! Even it works for videos too. You can modify the code for uploading any types of file. FYI, Flickr has used YUI (Yahoo User Interface) library for their uploader. So there is no licensing problem if you use this uploader for your own.</p>
<p>For my own need I added 2 extra fields. They are sent to server via POST method along with the FILES. One thing I&#8217;ve noticed, it can upload file faster than normal file uploading method. Cos, the file is encoded first via the flash uploader and somehow it is faster than normal.</p>
<p><img src="http://abcoder.com/YUI/select-multiple-files.jpg" alt="Upload Multiple File Once" width="500" height="299" /></p>
<p>And the great advantage is you can select multiple files during browsing by pressing Ctlr + A or select your files by dragging mouse. By using html &lt;input type=&#8221;file&#8221; /&gt; you can only select one file at a time which is really so boaring and life-taking when you want to upload hundreds of images.</p>
<p><img src="http://abcoder.com/YUI/Flickr-YUI-Uploader.jpg" alt="Flickr YUI Uploader" width="500" height="600" /></p>
<p><a title="Flickr Uploader using YUI" href="http://abcoder.com/YUI" target="_blank"><strong>Here is the online demo</strong></a>. The files are not being saved on my server for my own security!</p>
<p><a title="Free download Flickr Uploader using YUI - zip file." href="http://abcoder.com/YUI/Flickr-YUI.zip" target="_blank">Download it here completely free in a single zip file</a>!</p>
<p><strong>Modify the index_files/config.js file line no 49,<br />
var _site_root = &#8216;your script location&#8217;;</strong><br />
<strong>It won&#8217;t work for you until you change _site_root</strong></p>
<p>I have no problem if you use it for your own use. But I do not actually want anyone to put the files/zip on their own site to drive the traffics away from our blog.</p>
<p>If you need any support for modifying or setting it up or any bug report please contact me directly at <a title="adnan.eee@gmail.com" href="mailto:adnan.eee@gmail.com" target="_blank">adnan.eee@gmail.com</a></p>
<p>Thanks<br />
Have a pain-less uploading experience!</p>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/gmail-uploader-clone-with-drag-drop-feature-free-download-with-source-code/' rel='bookmark' title='Permanent Link: Gmail uploader clone with drag drop feature : Free Download with source code'>Gmail uploader clone with drag drop feature : Free Download with source code</a> <small>Gmail file uploader clone with drag drop feature using jQuery. Download full working source code in a single zip file for free....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
<li><a href='http://abcoder.com/flickr/flicka-on-android-market-is-knocking-at/' rel='bookmark' title='Permanent Link: Flicka on Android Market is knocking at'>Flicka on Android Market is knocking at</a> <small>Flickr.com is going to introduce its aptitude through Flicka on Android phone....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/flickr-uploader-clone-free-download-with-source-code/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Javascript timer &#8211; advanced features, simple to use</title>
		<link>http://abcoder.com/javascript/core_javascript/javascript_timer/</link>
		<comments>http://abcoder.com/javascript/core_javascript/javascript_timer/#comments</comments>
		<pubDate>Tue, 20 May 2008 12:49:38 +0000</pubDate>
		<dc:creator>zp bappi</dc:creator>
				<category><![CDATA[Core JavaScript]]></category>
		<category><![CDATA[advanved timer]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[multiple callback]]></category>
		<category><![CDATA[object oriented]]></category>
		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://abcoder.com/?p=9</guid>
		<description><![CDATA[javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain [...]


Related posts:<ol><li><a href='http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/' rel='bookmark' title='Permanent Link: IE6 fix for select box over absolute positioned element'>IE6 fix for select box over absolute positioned element</a> <small>The detailed instruction with css and jquery code for drop down menu over select box - fix for ie6....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/advanced-cycle-plugin-integration/' rel='bookmark' title='Permanent Link: Advanced cycle plugin integration'>Advanced cycle plugin integration</a> <small>Load only the current slide of a jQuery cycle plugin slideshow. For large size images slideshow, loading all the images at once highly affects the page loading time. Here is the technique to load one image once only before starting of the next slide. It'll definitely reduce the page loading time....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>javascript is the core of rich UI development and ajax driven website. i enjoy doing these. but in many cases, i thought things would be easier if the setTimeout(&#8230;) or setInterval(&#8230;) functions were simpler to handle. if you ever tried to make something like fadeout effect or accordion or anything that happens with a certain interval, you may understand what i mean. so, i thought it would be great to use a timer if anyone made already. i searched, got hundreds. but, none of them seemed perfect for me to use everywhere. for example, if you are familiar with visual basic (former) or .NET timer object, its very easy to use anywhere, anyhow. actually, this was the basic idea for my development (though it supports more than the basic).</p>
<p>so, i wrote a javascript timer object trying to provide a complete object oriented solution (basically for me, but you can use it too :). its very simple to use, yet very powerful. you can set your desired interval and a callback function which will be called after each interval.</p>
<p>the simplest use would be:</p>
<pre class="brush: jscript;">var timer = new Timer(1000, myfunction);
timer.start();</pre>
<p>first parameter sets the interval in milliseconds and second is the callback function to call. so, this will call myfunction() every second.</p>
<p>methods of Timer object and their parameters and return values (API reference) can be found <a href="http://abcoder.com/wp-content/uploads/2008/05/jstimer-api.html">here</a>.</p>
<p>but, dont you want something more? well, in that case, first of all you should know that Timer object supports concatenation for almost every function. so you can rewrite the above code as:</p>
<pre class="brush: jscript;">var timer = new Timer(1000, myfunction).start();</pre>
<p>whenever you want to stop the timer, just call:</p>
<pre class="brush: jscript;">timer.stop();</pre>
<p>isn&#8217;t that simple? well, that&#8217;s just the beginning.</p>
<p>its time you are introduced to some necessary functions:</p>
<pre class="brush: jscript;">//pauses the timer
timer.pause();

//resumes the timer, if it was paused
timer.resume();</pre>
<p>you should keep in mind that, there is a difference between stop() and pause(). when you pause the timer, it remembers how much of its interval is left. after resuming, it runs the remaining time of its interval. for example, if you set interval to 2000 milliseconds and pause the timer after running 1500 milliseconds; when you resume, it will call the callback function (i.e., myfunction ) after 500 milliseconds. this feature could be useful for rotating ads of news flashers in a website.</p>
<p>also, you have various functions like interval, addCallback, and many more. so, our very first code can be rewritten as:</p>
<pre class="brush: jscript;">var timer = new Timer().interval(1000).addCallback(myfunction).start();</pre>
<p>or, to please eyes:</p>
<pre class="brush: jscript;">var timer = new Timer();
timer.interval(1000)
.addCallback(myfunction)
.start();</pre>
<p>note that, Timer class also supports empty constructor like Timer() which is my personal favorite.</p>
<p>wait.. where is the multiple callback feature? well here it is:</p>
<pre class="brush: jscript;">var timer = new Timer();
timer.interval(1000)
.addCallback(myfunction1)
.addCallback(myfunction2)
//......
.addCallback(myfunctionN)
.start();</pre>
<p>okay? well, you should know that functions are executed in parallel. if you dont trust me, try this:</p>
<pre class="brush: jscript;">var timer = new Timer();
timer.interval(1000)
.addCallback( function() { alert('hi there.'); } )
.addCallback(myfunction)
.start();</pre>
<p>see, alert doesn&#8217;t block executing myfunction. i tried adding 20 callback functions. some of them showed time in a div, and some did something else. all of them executed in parallel. i.e., none block others&#8217; execution.</p>
<p>well, so far everything runs forever unless you call timer.stop() or timer.pause(). what if you want the basic setTimeout(&#8230;) function back? there&#8217;s a way:</p>
<pre class="brush: jscript;">var timer = new Timer();
timer.interval(1000)
.addCallback(myfunction1)
.addCallback(myfunction2)
.runOnce(true)
.start();</pre>
<p>this works same as setTimeout(&#8230;), i.e., executes myfunction1() and myfunction2() simultaneously one time after the specified interval. plus, you have the ability to stop or pause it anytime. is that sufficient for you? well, there&#8217;s more.</p>
<p>imagine, you are building an ajax driven webmail interface (for example, consider gmail). you have a clock showing current time in user&#8217;s inbox. also, you want to check if there is internet connection available in every 3 seconds. and you want to check for new mails in every 10 seconds. you may want more, but i will show you a skeleton program of these three feature using Timer object. your code should be something like this:</p>
<pre class="brush: jscript;">function update_clock(){
//code to update the clock
}

function check_connection(){
//code to check if there is connectivity with your server
//a simple XMLHttp request may be.
}

function check_mail(){
//an XMLHttp request to check for new mails
}

var timer = new Timer();
timer.interval(1000)
.addCallback(update_clock)
.addCallback(check_connection, 3)
.addCallback(check_mail, 10)
.start();</pre>
<p>isn&#8217;t that too easy for that complex task? notice the second parameter in addCallback method. think like, the Timer object generates a pulse at given interval. the second parameter of addCallback method tells Timer object that this callback method should be executed at every Nth pulse; where N=1, 2, 3, &#8230; (here, N=3, 10). the seconds parameter, N, is optional and default value is 1.</p>
<p>now, off the record, someone asked me, if it can trigger a callback function (say, check_connection function from the example above) in 1.5 second interval!!! whoever is thinking to pass 1.5 (that is the quickest solution, i guess) as the second parameter, please dont. it only accepts integer number. but, there&#8217;s a work around. you need to learn some elementary math and come back here. then you will come-up with a solution like this:</p>
<pre class="brush: jscript;">var timer = new Timer();
timer.interval(500)
.addCallback(update_clock, 2)    //500 * 2 = 1000
.addCallback(check_connection, 3)    //500 * 1.5 * 2 = 1500
.addCallback(check_mail, 20)    //500 * 10 * 2 = 10000
.start();</pre>
<p>thats a good solution and this is what i had in mind ;). wait, one question is still hanging.</p>
<p>what will happen if i add .runOnce(true) just above .start() in the example above?</p>
<p>well, what is desired? i think, each callback function should be executed exactly once. thats what i implemented. so, regardless of continuous pulses provided by Timer object, update_clock() will execute exactly once after 1 sec, check_connection() will execute once after 1.5 sec and check_mail() will execute once after 10 sec. then the timer will stop. any suggestion?</p>
<p>well, there are still few more functions left to mention. but, they are too easy to explain. see <a href="http://abcoder.com/wp-content/uploads/2008/05/jstimer-api.html">API Reference</a> for description/usage of functions of Timer object.</p>
<p>lastly be sure to have a <a href="http://www.webhostingsearch.com/asp-net-hosting.php">good asp.net web hosting provider</a>, it can make all the difference. for any suggestion, bug report or query, please leave a comment. hope you like it. </p>
<p>Links:</p>
<ul>
<li><a href="http://abcoder.com/wp-content/uploads/2008/05/jstimer-api.html">API Reference</a></li>
<li><a href="http://abcoder.com/wp-content/uploads/2008/05/timer.js">Source Code<br />
</a></li>
<li><a href="http://abcoder.com/wp-content/uploads/2008/05/jstimer-test.html">Examples</a></li>
</ul>


<p>Related posts:</p><ol><li><a href='http://abcoder.com/javascript/ie6-fix-for-select-box-over-absolute-positioned-element/' rel='bookmark' title='Permanent Link: IE6 fix for select box over absolute positioned element'>IE6 fix for select box over absolute positioned element</a> <small>The detailed instruction with css and jquery code for drop down menu over select box - fix for ie6....</small></li>
<li><a href='http://abcoder.com/javascript/jquery/advanced-cycle-plugin-integration/' rel='bookmark' title='Permanent Link: Advanced cycle plugin integration'>Advanced cycle plugin integration</a> <small>Load only the current slide of a jQuery cycle plugin slideshow. For large size images slideshow, loading all the images at once highly affects the page loading time. Here is the technique to load one image once only before starting of the next slide. It'll definitely reduce the page loading time....</small></li>
<li><a href='http://abcoder.com/javascript/how-to-get-currently-logged-on-windows-username-in-php-javascript/' rel='bookmark' title='Permanent Link: How to get currently logged on windows username in PHP and Javascript'>How to get currently logged on windows username in PHP and Javascript</a> <small>Get current windows username in php and javascript! Is that possible?...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://abcoder.com/javascript/core_javascript/javascript_timer/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
