<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: The .call(..) and .apply(..) functions</title>
	<atom:link href="http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/</link>
	<description>If you don&#039;t expect too much from me, you might not be let down.</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:23:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: siva charan</title>
		<link>http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/comment-page-1/#comment-119178</link>
		<dc:creator>siva charan</dc:creator>
		<pubDate>Sat, 27 Aug 2011 19:25:49 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2006/06/17/the-call-and-apply-functions/#comment-119178</guid>
		<description>one more thing is i found that if we are using setTimeout function like this

function chkUserName()
{
    stTimeout(&quot;document.getElementById(&#039;dSUpUName&#039;).focus()&quot;,100);
}
this is working fine.butwhy do we need that setTimeout function.........</description>
		<content:encoded><![CDATA[<p>one more thing is i found that if we are using setTimeout function like this</p>
<p>function chkUserName()<br />
{<br />
    stTimeout(&#034;document.getElementById(&#039;dSUpUName&#039;).focus()&#034;,100);<br />
}<br />
this is working fine.butwhy do we need that setTimeout function&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: siva charan</title>
		<link>http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/comment-page-1/#comment-119176</link>
		<dc:creator>siva charan</dc:creator>
		<pubDate>Sat, 27 Aug 2011 18:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2006/06/17/the-call-and-apply-functions/#comment-119176</guid>
		<description>thank you very much for your reply.i am sorry for providing insufficient data.what i am trying is which every one is doing now a days,it is checking username whether it is available to the user or not.here is my data.

html page:

    
        User Name
        
        Password
        	              
    

what i trying is chacking the username when user moves for the username field.for that i want to raise the onblur event handler with addEventListner or attachEvent,just like this. 

function loadEvents()
{
    if(document.addEventListener)
    {	          document.getElementById(&quot;dSUpUName&quot;).addEventListener(&quot;blur&quot;,chkUserName,false);
    }
    else
    {	 
        document.getElementById(&quot;dSUpUName&quot;).attachEvent(&quot;onblur&quot;,chkUserName);
    }
}
function chkUserName(e)
{
    //first i want to keep the foucs in the same element.for that i am using this.focus().
    this.focus();
    //return false;(first i tried like this to prevent default action)
    preventDefaultAction(e);
}
function preventDefaultAction(e)
{
    e = e ? e : window.event;
    if(e.preventDefault)
    {
        e.preventDefault();
    }
    else
    {
        e.returnValue = false;
    }
}

and one more important thing is when we attach that event handler to the html tag it is working fine in all browsers



for this the javascript code is

function chkUserName()
{
    document.getElementById(&#039;dSUpUName&#039;).focus();
    return false;
}

the problem occurs when we are trying to hadle the onblur event from javascript.
and why the onblur event behaves so special when compared to other events.

please help me...</description>
		<content:encoded><![CDATA[<p>thank you very much for your reply.i am sorry for providing insufficient data.what i am trying is which every one is doing now a days,it is checking username whether it is available to the user or not.here is my data.</p>
<p>html page:</p>
<p>        User Name</p>
<p>        Password</p>
<p>what i trying is chacking the username when user moves for the username field.for that i want to raise the onblur event handler with addEventListner or attachEvent,just like this. </p>
<p>function loadEvents()<br />
{<br />
    if(document.addEventListener)<br />
    {	          document.getElementById(&#034;dSUpUName&#034;).addEventListener(&#034;blur&#034;,chkUserName,false);<br />
    }<br />
    else<br />
    {<br />
        document.getElementById(&#034;dSUpUName&#034;).attachEvent(&#034;onblur&#034;,chkUserName);<br />
    }<br />
}<br />
function chkUserName(e)<br />
{<br />
    //first i want to keep the foucs in the same element.for that i am using this.focus().<br />
    this.focus();<br />
    //return false;(first i tried like this to prevent default action)<br />
    preventDefaultAction(e);<br />
}<br />
function preventDefaultAction(e)<br />
{<br />
    e = e ? e : window.event;<br />
    if(e.preventDefault)<br />
    {<br />
        e.preventDefault();<br />
    }<br />
    else<br />
    {<br />
        e.returnValue = false;<br />
    }<br />
}</p>
<p>and one more important thing is when we attach that event handler to the html tag it is working fine in all browsers</p>
<p>for this the javascript code is</p>
<p>function chkUserName()<br />
{<br />
    document.getElementById(&#039;dSUpUName&#039;).focus();<br />
    return false;<br />
}</p>
<p>the problem occurs when we are trying to hadle the onblur event from javascript.<br />
and why the onblur event behaves so special when compared to other events.</p>
<p>please help me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sstchur</title>
		<link>http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/comment-page-1/#comment-119119</link>
		<dc:creator>sstchur</dc:creator>
		<pubDate>Fri, 26 Aug 2011 20:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2006/06/17/the-call-and-apply-functions/#comment-119119</guid>
		<description>I don&#039;t quite understand what you&#039;re trying to do.  The syntax you used for preventing the default action (e.preventDefault() and e.returnValue = false) is correct.

But preventing the default action depends on the element and the event.  For instance, if you have a link:

&lt;a href = &quot;http://blog.stchur.com&quot; rel=&quot;nofollow&quot;&gt;stchur blog&lt;/a&gt;

And in a &#039;click&#039; event handler for that link, you prevent the default action, you are telling the browser &quot;don&#039;t do the think you normally do when a click occurs on a link.&quot;  In other words, you&#039;re telling the browser NOT to navigate to the href of that link (which would be its default action).

In your case, you are trying to prevent the default action of a &#039;blur&#039; event on some element &#039;#dSUpUName&#039; (which I have no idea what type of element that is because you haven&#039;t told us).  But in any case, I&#039;m not sure that preventing the default action of a &#039;blur&#039; is something the browser will let you do.  I would also question if you really want to do it -- it could make for a really lousy user experience.

You may be able to re-focus #dSUpUName from within a &#039;focus&#039; event handler of ANOTHER element.  In that case, you might want to wait until the user gets all the way through the form and focuses on the submit button.  At that point, perhaps you could validate the form and then call .focus() on the first invalid element you find.</description>
		<content:encoded><![CDATA[<p>I don&#039;t quite understand what you&#039;re trying to do.  The syntax you used for preventing the default action (e.preventDefault() and e.returnValue = false) is correct.</p>
<p>But preventing the default action depends on the element and the event.  For instance, if you have a link:</p>
<p>&lt;a href = &#034;http://blog.stchur.com&#034; rel=&#034;nofollow&#034;&gt;stchur blog&lt;/a&gt;</p>
<p>And in a &#039;click&#039; event handler for that link, you prevent the default action, you are telling the browser &#034;don&#039;t do the think you normally do when a click occurs on a link.&#034;  In other words, you&#039;re telling the browser NOT to navigate to the href of that link (which would be its default action).</p>
<p>In your case, you are trying to prevent the default action of a &#039;blur&#039; event on some element &#039;#dSUpUName&#039; (which I have no idea what type of element that is because you haven&#039;t told us).  But in any case, I&#039;m not sure that preventing the default action of a &#039;blur&#039; is something the browser will let you do.  I would also question if you really want to do it &#8212; it could make for a really lousy user experience.</p>
<p>You may be able to re-focus #dSUpUName from within a &#039;focus&#039; event handler of ANOTHER element.  In that case, you might want to wait until the user gets all the way through the form and focuses on the submit button.  At that point, perhaps you could validate the form and then call .focus() on the first invalid element you find.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: siva charan</title>
		<link>http://blog.stchur.com/2006/06/17/the-call-and-apply-functions/comment-page-1/#comment-119117</link>
		<dc:creator>siva charan</dc:creator>
		<pubDate>Fri, 26 Aug 2011 19:32:01 +0000</pubDate>
		<guid isPermaLink="false">http://stchur.com/blog2/2006/06/17/the-call-and-apply-functions/#comment-119117</guid>
		<description>facing problems in preventing default action of onblur.here is my dotbt
function loadEvents()
{
if(document.addEventListener)
{	 document.getElementById(&quot;dSUpUName&quot;).addEventListener(&quot;blur&quot;,chkUserName,false);
}
else
{	 document.getElementById(&quot;dSUpUName&quot;).attachEvent(&quot;onblur&quot;,chkUserName);
}
}
function chkUserName(e)
{
this.focus();
//return false;(first i tried like this to prevent default action)
preventDefaultAction(e);
}
function preventDefaultAction(e)
{
e = e ? e : window.event;
if(e.preventDefault)
{
e.preventDefault();
}
else
{
e.returnValue = false;
}
}
&lt;/form
how can i achieve this.i want to check that &quot;dSUpUName&quot; field with onblur.can you please help me regarding this</description>
		<content:encoded><![CDATA[<p>facing problems in preventing default action of onblur.here is my dotbt<br />
function loadEvents()<br />
{<br />
if(document.addEventListener)<br />
{	 document.getElementById(&#034;dSUpUName&#034;).addEventListener(&#034;blur&#034;,chkUserName,false);<br />
}<br />
else<br />
{	 document.getElementById(&#034;dSUpUName&#034;).attachEvent(&#034;onblur&#034;,chkUserName);<br />
}<br />
}<br />
function chkUserName(e)<br />
{<br />
this.focus();<br />
//return false;(first i tried like this to prevent default action)<br />
preventDefaultAction(e);<br />
}<br />
function preventDefaultAction(e)<br />
{<br />
e = e ? e : window.event;<br />
if(e.preventDefault)<br />
{<br />
e.preventDefault();<br />
}<br />
else<br />
{<br />
e.returnValue = false;<br />
}<br />
}<br />
&lt;/form<br />
how can i achieve this.i want to check that &quot;dSUpUName&quot; field with onblur.can you please help me regarding this</p>
]]></content:encoded>
	</item>
</channel>
</rss>

