<?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>Ye Meri Life Hai - Chirag Mehta &#187; Javascript</title>
	<atom:link href="http://www.chiragmehta.info/chirag/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chiragmehta.info/chirag</link>
	<description></description>
	<lastBuildDate>Wed, 21 Jul 2010 19:37:46 +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>YUI Library &#8211; The transparent mask turns black in IE 8</title>
		<link>http://www.chiragmehta.info/chirag/2010/03/23/yui-library-the-transparent-mask-turns-black-in-ie-8/</link>
		<comments>http://www.chiragmehta.info/chirag/2010/03/23/yui-library-the-transparent-mask-turns-black-in-ie-8/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 14:09:21 +0000</pubDate>
		<dc:creator>Chirag Mehta</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.chiragmehta.info/chirag/?p=2156</guid>
		<description><![CDATA[Problem Statement I use the YUI dialog in my project and turn on the &#8220;modal&#8221;, the initializing code looks like: document.mainDialog = new YAHOO.widget.Dialog(&#34;mainPanel&#34;, { modal: false, width: &#34;89em&#34;, height: &#34;30em&#34;, fixedcenter: true, visible: false, constraintoviewport: true }); The modal works fine in IE 7.0 and Fireforx 3.0, it generates a transparent mask to prevent [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem Statement</strong><br />
I use the YUI dialog in my project and turn on the &#8220;modal&#8221;, the initializing code looks like:</p>
<blockquote><p><code>document.mainDialog = new YAHOO.widget.Dialog(&quot;mainPanel&quot;,<br />
                              {   modal: false,<br />
                                  width: &quot;89em&quot;,<br />
                                  height: &quot;30em&quot;,<br />
                                  fixedcenter: true,<br />
                                  visible: false,<br />
                                  constraintoviewport: true<br />
                              });</code></p></blockquote>
<p>The modal works fine in IE 7.0 and Fireforx 3.0, it generates a transparent mask to prevent activating any elements in the document before closing the modal. But in IE 8.0, the transparent mask turns to &#8220;black&#8221;, rather than &#8220;transparent&#8221;. </p>
<p><strong>Solution</strong><br />
The cause is that IE8 does not support the CSS3 &#8216;opacity&#8217; selector. But YUI uses this to style the mask as follows:</p>
<blockquote><p>.yui-skin-sam .mask {<br />
background-color:#000000;<br />
opacity:0.25;<br />
}
</p></blockquote>
<p>To solve this problem &#8211; I have an IE specific stylesheet in which I override the above style as follows:</p>
<blockquote><p>.yui-skin-sam .mask{<br />
filter: alpha(opacity=30);<br />
}
</p></blockquote>
<p>Read more about the bug @ <a href="http://yuilibrary.com/projects/yui2/ticket/2528621" target="_blank">YUI Library</a></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F&amp;title=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208&amp;notes=Problem%20Statement%0D%0AI%20use%20the%20YUI%20dialog%20in%20my%20project%20and%20turn%20on%20the%20%22modal%22%2C%20the%20initializing%20code%20looks%20like%3A%0D%0Adocument.mainDialog%20%3D%20new%20YAHOO.widget.Dialog%28%26quot%3BmainPanel%26quot%3B%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20modal%3A%20false%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20" title="del.icio.us"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F&amp;t=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208" title="Facebook"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F&amp;title=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208&amp;annotation=Problem%20Statement%0D%0AI%20use%20the%20YUI%20dialog%20in%20my%20project%20and%20turn%20on%20the%20%22modal%22%2C%20the%20initializing%20code%20looks%20like%3A%0D%0Adocument.mainDialog%20%3D%20new%20YAHOO.widget.Dialog%28%26quot%3BmainPanel%26quot%3B%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20modal%3A%20false%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20" title="Google Bookmarks"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208&amp;body=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F" title="email"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F&amp;title=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208&amp;source=Ye+Meri+Life+Hai+-+Chirag+Mehta+&amp;summary=Problem%20Statement%0D%0AI%20use%20the%20YUI%20dialog%20in%20my%20project%20and%20turn%20on%20the%20%22modal%22%2C%20the%20initializing%20code%20looks%20like%3A%0D%0Adocument.mainDialog%20%3D%20new%20YAHOO.widget.Dialog%28%26quot%3BmainPanel%26quot%3B%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20modal%3A%20false%2C%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20" title="LinkedIn"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2010%2F03%2F23%2Fyui-library-the-transparent-mask-turns-black-in-ie-8%2F&amp;title=YUI%20Library%20-%20The%20transparent%20mask%20turns%20black%20in%20IE%208" title="Live"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.chiragmehta.info/chirag/feed/" title="RSS"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chiragmehta.info/chirag/2010/03/23/yui-library-the-transparent-mask-turns-black-in-ie-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Submit a Form in Internet Explorer with Enter</title>
		<link>http://www.chiragmehta.info/chirag/2009/11/17/submit-a-form-in-internet-explorer-with-enter/</link>
		<comments>http://www.chiragmehta.info/chirag/2009/11/17/submit-a-form-in-internet-explorer-with-enter/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 23:04:46 +0000</pubDate>
		<dc:creator>Chirag Mehta</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.chiragmehta.info/chirag/?p=1869</guid>
		<description><![CDATA[Ran into an (other) interesting Internet Explorer bug. Seems that if you have a form with only a single text input, hitting the enter button will not submit the form in IE. &#60;form action=&#34;&#34; method=&#34;post&#34;&#62; &#60;fieldset&#62; &#60;label for=&#34;user_name&#34;&#62;User Name&#60;/label&#62; &#60;input type=&#34;text&#34; name=&#34;user_name&#34; id=&#34;user_name&#34; /&#62; &#60;/fieldset&#62; &#60;fieldset class=&#34;button&#34;&#62; &#60;button type=&#34;submit&#34; name=&#34;submit&#34; id=&#34;submit&#34; title=&#34;Verify User Name&#34;&#62;Verify User [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into an (other) interesting Internet Explorer bug. Seems that if you have a form with only a single text input, hitting the enter button will not submit the form in IE.</p>
<p><code>&lt;form action=&quot;&quot; method=&quot;post&quot;&gt;<br />    &lt;fieldset&gt;<br />        &lt;label for=&quot;user_name&quot;&gt;User Name&lt;/label&gt;<br />        &lt;input type=&quot;text&quot; name=&quot;user_name&quot; id=&quot;user_name&quot; /&gt;<br />    &lt;/fieldset&gt;<br />    &lt;fieldset class=&quot;button&quot;&gt;<br />        &lt;button type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; title=&quot;Verify User Name&quot;&gt;Verify User Name&lt;/button&gt;<br />    &lt;/fieldset&gt;<br />&lt;/form&gt;</code></p>
<p>The solution is to hide an additional disabled input for IE to find, using IE conditional Comments and hiding it from view with some CSS.</p>
<p><code>&lt;form action=&quot;&quot; method=&quot;post&quot;&gt;<br />    &lt;fieldset&gt;<br />        &lt;!--[if IE]&gt;&lt;input type=&quot;text&quot; style=&quot;display: none;&quot; disabled=&quot;disabled&quot; size=&quot;1&quot; /&gt;&lt;![endif]--&gt;<br />        &lt;label for=&quot;user_name&quot;&gt;User Name&lt;/label&gt;<br />        &lt;input type=&quot;text&quot; name=&quot;user_name&quot; id=&quot;user_name&quot; /&gt;<br />    &lt;/fieldset&gt;<br />    &lt;fieldset class=&quot;button&quot;&gt;<br />        &lt;button type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; title=&quot;Verify User Name&quot;&gt;Verify User Name&lt;/button&gt;<br />    &lt;/fieldset&gt;<br />&lt;/form&gt;</code></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F&amp;title=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter&amp;notes=Ran%20into%20an%20%28other%29%20interesting%20Internet%20Explorer%20bug.%20Seems%20that%20if%20you%20have%20a%20form%20with%20only%20a%20single%20text%20input%2C%20hitting%20the%20enter%20button%20will%20not%20submit%20the%20form%20in%20IE.%0D%0A%0D%0A%26lt%3Bform%20action%3D%26quot%3B%26quot%3B%20method%3D%26quot%3Bpost%26quot%3B%26gt%3B%20%20%20%20%26lt%3Bfieldset%26g" title="del.icio.us"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F&amp;t=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter" title="Facebook"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F&amp;title=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter&amp;annotation=Ran%20into%20an%20%28other%29%20interesting%20Internet%20Explorer%20bug.%20Seems%20that%20if%20you%20have%20a%20form%20with%20only%20a%20single%20text%20input%2C%20hitting%20the%20enter%20button%20will%20not%20submit%20the%20form%20in%20IE.%0D%0A%0D%0A%26lt%3Bform%20action%3D%26quot%3B%26quot%3B%20method%3D%26quot%3Bpost%26quot%3B%26gt%3B%20%20%20%20%26lt%3Bfieldset%26g" title="Google Bookmarks"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter&amp;body=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F" title="email"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F&amp;title=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter&amp;source=Ye+Meri+Life+Hai+-+Chirag+Mehta+&amp;summary=Ran%20into%20an%20%28other%29%20interesting%20Internet%20Explorer%20bug.%20Seems%20that%20if%20you%20have%20a%20form%20with%20only%20a%20single%20text%20input%2C%20hitting%20the%20enter%20button%20will%20not%20submit%20the%20form%20in%20IE.%0D%0A%0D%0A%26lt%3Bform%20action%3D%26quot%3B%26quot%3B%20method%3D%26quot%3Bpost%26quot%3B%26gt%3B%20%20%20%20%26lt%3Bfieldset%26g" title="LinkedIn"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F17%2Fsubmit-a-form-in-internet-explorer-with-enter%2F&amp;title=Submit%20a%20Form%20in%20Internet%20Explorer%20with%20Enter" title="Live"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.chiragmehta.info/chirag/feed/" title="RSS"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chiragmehta.info/chirag/2009/11/17/submit-a-form-in-internet-explorer-with-enter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Executing JavaScript on page load</title>
		<link>http://www.chiragmehta.info/chirag/2009/11/04/executing-javascript-on-page-load/</link>
		<comments>http://www.chiragmehta.info/chirag/2009/11/04/executing-javascript-on-page-load/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 03:07:54 +0000</pubDate>
		<dc:creator>Chirag Mehta</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.chiragmehta.info/chirag/?p=1815</guid>
		<description><![CDATA[Following code helps you to define any JS function to be called on page load. The tricky part of the code is that it waits until page is completely loaded. &#60;script&#62; function init() { alert('Loaded'); } var previousOnload = window.onload; window.onload = function() { if (previousOnload) { alert('...loading ...'); previousOnload(); } init(); }&#60;/script&#62; Share and [...]]]></description>
			<content:encoded><![CDATA[<p>Following code helps you to define any JS function to be called on page load. The tricky part of the code is that <strong>it waits until page is completely loaded. </strong></p>
<p><code><br />
&lt;script&gt;<br />    function init() {                <br />        alert('Loaded');<br />    }</p>
<p>    var previousOnload = window.onload;        <br />    window.onload = function() { <br />        if (previousOnload) {<br />	    alert('...loading ...');	<br />            previousOnload();<br />        }</p>
<p>        init();<br />    }<br />&lt;/script&gt;<br />
</code></p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F&amp;title=Executing%20JavaScript%20on%20page%20load&amp;notes=Following%20code%20helps%20you%20to%20define%20any%20JS%20function%20to%20be%20called%20on%20page%20load.%20The%20tricky%20part%20of%20the%20code%20is%20that%20it%20waits%20until%20page%20is%20completely%20loaded.%20%0D%0A%0D%0A%0D%0A%26lt%3Bscript%26gt%3B%20%20%20%20function%20init%28%29%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert%28%27Loaded%27%29%3B%20%20%20%20%7D%20%20%20%20%20%20%20%20" title="del.icio.us"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F&amp;t=Executing%20JavaScript%20on%20page%20load" title="Facebook"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F&amp;title=Executing%20JavaScript%20on%20page%20load&amp;annotation=Following%20code%20helps%20you%20to%20define%20any%20JS%20function%20to%20be%20called%20on%20page%20load.%20The%20tricky%20part%20of%20the%20code%20is%20that%20it%20waits%20until%20page%20is%20completely%20loaded.%20%0D%0A%0D%0A%0D%0A%26lt%3Bscript%26gt%3B%20%20%20%20function%20init%28%29%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert%28%27Loaded%27%29%3B%20%20%20%20%7D%20%20%20%20%20%20%20%20" title="Google Bookmarks"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Executing%20JavaScript%20on%20page%20load&amp;body=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F" title="email"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F&amp;title=Executing%20JavaScript%20on%20page%20load&amp;source=Ye+Meri+Life+Hai+-+Chirag+Mehta+&amp;summary=Following%20code%20helps%20you%20to%20define%20any%20JS%20function%20to%20be%20called%20on%20page%20load.%20The%20tricky%20part%20of%20the%20code%20is%20that%20it%20waits%20until%20page%20is%20completely%20loaded.%20%0D%0A%0D%0A%0D%0A%26lt%3Bscript%26gt%3B%20%20%20%20function%20init%28%29%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert%28%27Loaded%27%29%3B%20%20%20%20%7D%20%20%20%20%20%20%20%20" title="LinkedIn"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2009%2F11%2F04%2Fexecuting-javascript-on-page-load%2F&amp;title=Executing%20JavaScript%20on%20page%20load" title="Live"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.chiragmehta.info/chirag/feed/" title="RSS"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chiragmehta.info/chirag/2009/11/04/executing-javascript-on-page-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript HtmlEncode/HtmlDecode</title>
		<link>http://www.chiragmehta.info/chirag/2007/06/15/javascript-htmlencodehtmldecode/</link>
		<comments>http://www.chiragmehta.info/chirag/2007/06/15/javascript-htmlencodehtmldecode/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 08:38:14 +0000</pubDate>
		<dc:creator>Chirag Mehta</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.chiragmehta.info/chirag/2007/06/15/javascript-htmlencodehtmldecode/</guid>
		<description><![CDATA[Ack:- Lunar Media Have you ever needed to HtmlEncode a querystring using JavaScript? Yes you may say, and several people will claim that you should UrlEncode it using escape(str); For some unknown reason I tried doing exactly that and UrlDecode the variable in csharp with no luck. Instead I found a solution in the Prototype [...]]]></description>
			<content:encoded><![CDATA[<p>Ack:- <a href = "http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx">Lunar Media</a></p>
<p>Have you ever needed to HtmlEncode a querystring using JavaScript? Yes you may say, and several people will claim that you should UrlEncode it using escape(str); For some unknown reason I tried doing exactly that and UrlDecode the variable in csharp with no luck. Instead I found a solution in the Prototype library, appropriately they call it escapeHTML:</p>
<p>function escapeHTML (str)<br />
{<br />
   var div = document.createElement(&#8216;div&#8217;);<br />
   var text = document.createTextNode(str);<br />
   div.appendChild(text);<br />
   return div.innerHTML;<br />
};</p>
<p>Wonderful simple and effective trick using the browsers own automatic Html converter.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F&amp;title=Javascript%20HtmlEncode%2FHtmlDecode&amp;notes=Ack%3A-%20Lunar%20Media%0D%0A%0D%0AHave%20you%20ever%20needed%20to%20HtmlEncode%20a%20querystring%20using%20JavaScript%3F%20Yes%20you%20may%20say%2C%20and%20several%20people%20will%20claim%20that%20you%20should%20UrlEncode%20it%20using%20escape%28str%29%3B%20For%20some%20unknown%20reason%20I%20tried%20doing%20exactly%20that%20and%20UrlDecode%20th" title="del.icio.us"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F&amp;t=Javascript%20HtmlEncode%2FHtmlDecode" title="Facebook"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F&amp;title=Javascript%20HtmlEncode%2FHtmlDecode&amp;annotation=Ack%3A-%20Lunar%20Media%0D%0A%0D%0AHave%20you%20ever%20needed%20to%20HtmlEncode%20a%20querystring%20using%20JavaScript%3F%20Yes%20you%20may%20say%2C%20and%20several%20people%20will%20claim%20that%20you%20should%20UrlEncode%20it%20using%20escape%28str%29%3B%20For%20some%20unknown%20reason%20I%20tried%20doing%20exactly%20that%20and%20UrlDecode%20th" title="Google Bookmarks"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Javascript%20HtmlEncode%2FHtmlDecode&amp;body=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F" title="email"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F&amp;title=Javascript%20HtmlEncode%2FHtmlDecode&amp;source=Ye+Meri+Life+Hai+-+Chirag+Mehta+&amp;summary=Ack%3A-%20Lunar%20Media%0D%0A%0D%0AHave%20you%20ever%20needed%20to%20HtmlEncode%20a%20querystring%20using%20JavaScript%3F%20Yes%20you%20may%20say%2C%20and%20several%20people%20will%20claim%20that%20you%20should%20UrlEncode%20it%20using%20escape%28str%29%3B%20For%20some%20unknown%20reason%20I%20tried%20doing%20exactly%20that%20and%20UrlDecode%20th" title="LinkedIn"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F06%2F15%2Fjavascript-htmlencodehtmldecode%2F&amp;title=Javascript%20HtmlEncode%2FHtmlDecode" title="Live"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.chiragmehta.info/chirag/feed/" title="RSS"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chiragmehta.info/chirag/2007/06/15/javascript-htmlencodehtmldecode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Direct Population of Form Values using Javascript</title>
		<link>http://www.chiragmehta.info/chirag/2007/03/09/direct-population-of-form-values-using-javascript/</link>
		<comments>http://www.chiragmehta.info/chirag/2007/03/09/direct-population-of-form-values-using-javascript/#comments</comments>
		<pubDate>Fri, 09 Mar 2007 08:51:05 +0000</pubDate>
		<dc:creator>Chirag Mehta</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.chiragmehta.info/chirag/2007/03/09/direct-population-of-form-values-using-javascript/</guid>
		<description><![CDATA[Type the following code in Address bar to fill the form fields named Ad1 and Ad2 wth certain text. javascript:function A(){document.getElementById(&#8216;Ad1&#8242;).value =&#8221;sadAS1&#8243;;document.getElementById(&#8216;Ad2&#8242;).value = &#8220;sadAS2&#8243;;}setTimeout(&#8216;A()&#8217;); void(0) Share and Enjoy:]]></description>
			<content:encoded><![CDATA[<p>Type the following code in Address bar to fill the form fields named Ad1 and Ad2 wth certain text.</p>
<blockquote><p>javascript:function A(){document.getElementById(&#8216;Ad1&#8242;).value =&#8221;sadAS1&#8243;;document.getElementById(&#8216;Ad2&#8242;).value = &#8220;sadAS2&#8243;;}setTimeout(&#8216;A()&#8217;); void(0)</p></blockquote>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F&amp;title=Direct%20Population%20of%20Form%20Values%20using%20Javascript&amp;notes=Type%20the%20following%20code%20in%20Address%20bar%20to%20fill%20the%20form%20fields%20named%20Ad1%20and%20Ad2%20wth%20certain%20text.%0D%0Ajavascript%3Afunction%20A%28%29%7Bdocument.getElementById%28%27Ad1%27%29.value%20%3D%22sadAS1%22%3Bdocument.getElementById%28%27Ad2%27%29.value%20%3D%20%22sadAS2%22%3B%7DsetTimeout%28%27A%28%29%27%29%3B%20void%280%29" title="del.icio.us"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F&amp;t=Direct%20Population%20of%20Form%20Values%20using%20Javascript" title="Facebook"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F&amp;title=Direct%20Population%20of%20Form%20Values%20using%20Javascript&amp;annotation=Type%20the%20following%20code%20in%20Address%20bar%20to%20fill%20the%20form%20fields%20named%20Ad1%20and%20Ad2%20wth%20certain%20text.%0D%0Ajavascript%3Afunction%20A%28%29%7Bdocument.getElementById%28%27Ad1%27%29.value%20%3D%22sadAS1%22%3Bdocument.getElementById%28%27Ad2%27%29.value%20%3D%20%22sadAS2%22%3B%7DsetTimeout%28%27A%28%29%27%29%3B%20void%280%29" title="Google Bookmarks"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="mailto:?subject=Direct%20Population%20of%20Form%20Values%20using%20Javascript&amp;body=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F" title="email"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F&amp;title=Direct%20Population%20of%20Form%20Values%20using%20Javascript&amp;source=Ye+Meri+Life+Hai+-+Chirag+Mehta+&amp;summary=Type%20the%20following%20code%20in%20Address%20bar%20to%20fill%20the%20form%20fields%20named%20Ad1%20and%20Ad2%20wth%20certain%20text.%0D%0Ajavascript%3Afunction%20A%28%29%7Bdocument.getElementById%28%27Ad1%27%29.value%20%3D%22sadAS1%22%3Bdocument.getElementById%28%27Ad2%27%29.value%20%3D%20%22sadAS2%22%3B%7DsetTimeout%28%27A%28%29%27%29%3B%20void%280%29" title="LinkedIn"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.chiragmehta.info%2Fchirag%2F2007%2F03%2F09%2Fdirect-population-of-form-values-using-javascript%2F&amp;title=Direct%20Population%20of%20Form%20Values%20using%20Javascript" title="Live"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  target="_blank" href="http://www.chiragmehta.info/chirag/feed/" title="RSS"><img src="http://www.chiragmehta.info/chirag/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.chiragmehta.info/chirag/2007/03/09/direct-population-of-form-values-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
