<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>DotNet Friends &#187; JavaScript</title>
	<atom:link href="http://amitpatriwala.wordpress.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://amitpatriwala.wordpress.com</link>
	<description>Amit Patriwala</description>
	<lastBuildDate>Fri, 23 Oct 2009 11:29:38 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='amitpatriwala.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/44c446cc3b78325e084c6ab6861a8b20?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>DotNet Friends &#187; JavaScript</title>
		<link>http://amitpatriwala.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://amitpatriwala.wordpress.com/osd.xml" title="DotNet Friends" />
		<item>
		<title>GridView Data Print In Asp.net 2.0</title>
		<link>http://amitpatriwala.wordpress.com/2008/07/26/gridview-data-print-in-aspnet-20/</link>
		<comments>http://amitpatriwala.wordpress.com/2008/07/26/gridview-data-print-in-aspnet-20/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 06:48:21 +0000</pubDate>
		<dc:creator>patriwala</dc:creator>
				<category><![CDATA[Asp.Net 2.0]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[gridview data print]]></category>
		<category><![CDATA[How to Print in ASP.NET 2.0]]></category>
		<category><![CDATA[How to print the data from the GridView]]></category>

		<guid isPermaLink="false">http://amitpatriwala.wordpress.com/?p=151</guid>
		<description><![CDATA[here is the steps:
1) create simple web application (here i used asp.net with C#).
2) put following control in to Page.
 1) Gridview (id = GridView1)
 2) html button (id =Button1)
 
&#60;inputid=&#8221;Button1&#8243;type=&#8221;button&#8221;value=&#8221;Print&#8221;language=&#8221;javascript&#8221;onclick=&#8221;return Button1_onclick()&#8221; /&#62;
&#60;asp:GridViewID=&#8221;GridView1&#8243;runat=&#8221;server&#8221;&#62;
&#60;/asp:GridView&#62;

3)  fill data into GridView
//here i used the list you  can bind with database also
System.Collections.Generic.List&#60;string&#62; obj = newSystem.Collections.Generic.List&#60;string&#62;();
 for(inti = 0; i &#60; 10; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=151&subd=amitpatriwala&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-size:small;">here is the steps:</span></p>
<p><span style="font-size:small;">1) create simple web application (here i used asp.net with C#).</span></p>
<p><span style="font-size:small;">2) put following control in to Page.</span></p>
<p><span style="font-size:small;"> 1) Gridview (id = GridView1)</span></p>
<p><span style="font-size:small;"> 2) html button (id =Button1)</span></p>
<p><span style="font-size:small;"> </span></p>
<p><span style="font-size:small;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">input</span><span style="color:red;">id</span><span style="color:blue;">=&#8221;Button1&#8243;</span><span style="color:red;">type</span><span style="color:blue;">=&#8221;button&#8221;</span><span style="color:red;">value</span><span style="color:blue;">=&#8221;Print&#8221;</span><span style="color:red;">language</span><span style="color:blue;">=&#8221;javascript&#8221;</span><span style="color:red;">onclick</span></span><span style="font-size:small;"><span style="color:blue;">=&#8221;return Button1_onclick()&#8221; /&gt;<br />
&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">GridView</span><span style="color:red;">ID</span><span style="color:blue;">=&#8221;GridView1&#8243;</span><span style="color:red;">runat</span></span><span style="font-size:small;"><span style="color:blue;">=&#8221;server&#8221;&gt;<br />
&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">GridView</span><span style="color:blue;">&gt;</span></span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><span style="font-size:small;">3)  fill data into GridView</span></p>
<p><span style="font-size:small;"><span style="color:green;">//here i used the list you  can bind with database also<br />
</span>System.Collections.Generic.<span style="color:#2b91af;">List</span>&lt;<span style="color:blue;">string</span>&gt; obj = <span style="color:blue;">new</span>System.Collections.Generic.<span style="color:#2b91af;">List</span>&lt;<span style="color:blue;">string</span>&gt;();</span></p>
<p><span style="font-size:small;"> <span style="color:blue;">for</span>(<span style="color:blue;">int</span>i = 0; i &lt; 10; i++)<br />
{<br />
obj.Add(i.ToString());<br />
}<br />
GridView1.DataSource = obj;<br />
GridView1.DataBind();<br />
4) now write the print function. click on the Button1 or write Java Script.</span></p>
<pre class="code"><span style="font-size:small;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">script </span><span style="color:red;">language</span><span style="color:blue;">="javascript" </span><span style="color:red;">type</span></span><span style="font-size:small;"><span style="color:blue;">="text/javascript"&gt;
</span>&lt;!--
<span style="color:blue;">function </span>Button1_onclick() {
</span><span style="font-size:small;"><span style="color:green;">//open new window set the height and width =0,set windows position at bottom
</span><span style="color:blue;">var </span>a = window.open (<span style="color:#a31515;">''</span>,<span style="color:#a31515;">''</span>,<span style="color:#a31515;">'left =' </span>+ screen.width + <span style="color:#a31515;">',top=' </span>+ screen.height + <span style="color:#a31515;">',width=0,height=0,toolbar=0,scrollbars=0,status=0'</span>);
</span><span style="font-size:small;"><span style="color:green;">//write gridview data into newly open window
</span>a.document.write(document.getElementById(<span style="color:#a31515;">'&lt;%= GridView1.ClientID %&gt;'</span>).innerHTML);
a.document.close();
a.focus();
</span><span style="font-size:small;"><span style="color:green;">//call print
</span>a.print();
a.close();
<span style="color:blue;">return false</span>;
}
</span><span style="font-size:small;"><span style="color:green;">// --&gt;
</span><span style="color:blue;">&lt;/</span><span style="color:#a31515;">script</span><span style="color:blue;">&gt;</span></span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><span style="font-size:small;"> </span></p>
<p><span style="font-size:small;">Thanks</span></p>
<p><span style="font-size:small;"> </span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/amitpatriwala.wordpress.com/151/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/amitpatriwala.wordpress.com/151/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amitpatriwala.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amitpatriwala.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amitpatriwala.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amitpatriwala.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amitpatriwala.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amitpatriwala.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amitpatriwala.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amitpatriwala.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amitpatriwala.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amitpatriwala.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=151&subd=amitpatriwala&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://amitpatriwala.wordpress.com/2008/07/26/gridview-data-print-in-aspnet-20/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12ba624e5155b632d14a31227425a46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">patriwala</media:title>
		</media:content>
	</item>
		<item>
		<title>Disabled Right Click On Web Site</title>
		<link>http://amitpatriwala.wordpress.com/2008/07/04/disabled-right-click-on-web-site/</link>
		<comments>http://amitpatriwala.wordpress.com/2008/07/04/disabled-right-click-on-web-site/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 07:00:50 +0000</pubDate>
		<dc:creator>patriwala</dc:creator>
				<category><![CDATA[Asp.Net 2.0]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[disable right click on web page]]></category>
		<category><![CDATA[no right click]]></category>
		<category><![CDATA[disable copy and paste]]></category>
		<category><![CDATA[secure web site]]></category>
		<category><![CDATA[Disable right mouse click script]]></category>
		<category><![CDATA[Disable Right Click]]></category>

		<guid isPermaLink="false">http://amitpatriwala.wordpress.com/?p=119</guid>
		<description><![CDATA[steps :
1) create simple application (html).
2) put the below javascript in to the code.
&#60;script language="JavaScript"&#62;
      // on right click appear this message
      var DisplayMsg="Right Click Disabled";
      //return message
      function clickBYIE()
      [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=119&subd=amitpatriwala&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-size:small;">steps :</span></p>
<p><span style="font-size:small;">1) create simple application (html).</span></p>
<p><span style="font-size:small;">2) put the below javascript in to the code.</span></p>
<pre><span style="font-size:small;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">script </span><span style="color:red;">language</span></span><span style="color:blue;"><span style="font-size:small;">="JavaScript"&gt;
      </span></span><span style="font-size:small;"><span style="color:green;">// on right click appear this message
      </span><span style="color:blue;">var </span>DisplayMsg=<span style="color:#a31515;">"Right Click Disabled"</span>;
      </span><span style="font-size:small;"><span style="color:green;">//return message
      </span><span style="color:blue;">function </span>clickBYIE()
      {
          <span style="color:blue;">if</span>(document.all)
          {
              alert(DisplayMsg);
              <span style="color:blue;">return false</span>;
          }
      }
      </span><span style="font-size:small;"><span style="color:green;">//return message
      </span><span style="color:blue;">function </span>clickBYNS(e)
      {
          <span style="color:blue;">if </span>(document.layers||(document.getElementById&amp;&amp;!document.all))
          {
              <span style="color:blue;">if </span>(e.which==2||e.which==3)
              {
               alert(DisplayMsg);
               <span style="color:blue;">return false</span>;
              }
          }
      }

     </span><span style="font-size:small;"><span style="color:green;">//set the function as per browser
      </span><span style="color:blue;">if </span>(document.layers)
      {
          document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickBYNS;
      }
      </span><span style="font-size:small;"><span style="color:blue;">else
      </span>{
          document.onmouseup=clickBYNS;document.oncontextmenu=clickBYIE;
      }
      </span><span style="font-size:small;"><span style="color:green;">//disabled the right click on the browser
       </span>document.oncontextmenu=<span style="color:blue;">new </span>Function(<span style="color:#a31515;">"return false"</span>)
  <span style="color:blue;">&lt;/</span><span style="color:#a31515;">script</span><span style="color:blue;">&gt;</span></span></pre>
<pre><span style="color:blue;"><span style="font-family:Trebuchet MS;color:#000000;font-size:small;">run the code and check.</span></span></pre>
<pre><span style="color:blue;"><span style="font-family:Trebuchet MS;color:#000000;font-size:small;">thnx</span></span></pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/amitpatriwala.wordpress.com/119/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/amitpatriwala.wordpress.com/119/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amitpatriwala.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amitpatriwala.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amitpatriwala.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amitpatriwala.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amitpatriwala.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amitpatriwala.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amitpatriwala.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amitpatriwala.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amitpatriwala.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amitpatriwala.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=119&subd=amitpatriwala&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://amitpatriwala.wordpress.com/2008/07/04/disabled-right-click-on-web-site/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12ba624e5155b632d14a31227425a46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">patriwala</media:title>
		</media:content>
	</item>
		<item>
		<title>Window Resize Using JavaScript</title>
		<link>http://amitpatriwala.wordpress.com/2008/04/19/window-resize-using-javascript/</link>
		<comments>http://amitpatriwala.wordpress.com/2008/04/19/window-resize-using-javascript/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 19:26:42 +0000</pubDate>
		<dc:creator>patriwala</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript resize a window]]></category>
		<category><![CDATA[Resizing window using javascript]]></category>

		<guid isPermaLink="false">http://amitpatriwala.wordpress.com/2008/04/19/window-resize-using-javascript/</guid>
		<description><![CDATA[steps :
1) Create the Simple Web Application.
2) in the body written below function for resize the window.
&#60;body onload="Maximize();"&#62;
3) in the JavaScript put the below code.
&#60;script language=&#8221;javascript&#8221;&#62;
 function Maximize()
{
//move the window to 0,0 co-ordinate
 window.moveTo(0,0);
//width is the screen width but minus 25 from the height
 //reson to minus 25 Taskbar
 //resize the window
 window.resizeTo(screen.width,screen.height-25);
}
&#60;/script&#62;
Thanks.
   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=28&subd=amitpatriwala&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>steps :</p>
<p>1) Create the Simple Web Application.</p>
<p>2) in the body written below function for resize the window.</p>
<pre>&lt;body onload=<span class="str">"Maximize();"</span>&gt;</pre>
<p>3) in the JavaScript put the below code.</p>
<p><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">script</span><span style="color:#000000;"> </span><span style="color:#ff0000;">language</span><span style="color:#0000ff;">=&#8221;javascript&#8221;&gt;<br />
</span><span style="color:#000000;"> </span><span style="color:#0000ff;">function</span><span style="color:#000000;"> Maximize()<br />
{<br />
</span><span style="color:#008000;">//move the window to 0,0 co-ordinate<br />
</span><span style="color:#000000;"> window.moveTo(0,0);<br />
</span><span style="color:#008000;">//width is the screen width but minus 25 from the height<br />
</span><span style="color:#000000;"> </span><span style="color:#008000;">//reson to minus 25 Taskbar<br />
</span><span style="color:#000000;"> </span><span style="color:#008000;">//resize the window<br />
</span><span style="color:#000000;"> window.resizeTo(screen.width,screen.height-25);<br />
}<br />
</span><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></p>
<pre>Thanks.</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/amitpatriwala.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/amitpatriwala.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amitpatriwala.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amitpatriwala.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amitpatriwala.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amitpatriwala.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amitpatriwala.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amitpatriwala.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amitpatriwala.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amitpatriwala.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amitpatriwala.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amitpatriwala.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=28&subd=amitpatriwala&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://amitpatriwala.wordpress.com/2008/04/19/window-resize-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12ba624e5155b632d14a31227425a46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">patriwala</media:title>
		</media:content>
	</item>
		<item>
		<title>HightLight Error Message In JavaScript</title>
		<link>http://amitpatriwala.wordpress.com/2008/04/16/hightlight-error-message-in-javascript/</link>
		<comments>http://amitpatriwala.wordpress.com/2008/04/16/hightlight-error-message-in-javascript/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 07:03:17 +0000</pubDate>
		<dc:creator>patriwala</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Client Side Validation with JavaScript in ASP.NET]]></category>
		<category><![CDATA[Form Validation using JavaScript]]></category>
		<category><![CDATA[How to manage ASP.NET validation from Javascript?]]></category>
		<category><![CDATA[Setting ErrorMessage using JavaScript]]></category>
		<category><![CDATA[Show Error message using Javascript]]></category>
		<category><![CDATA[Validation Using Javascript]]></category>
		<category><![CDATA[validation using javascript in asp.net]]></category>

		<guid isPermaLink="false">http://amitpatriwala.wordpress.com/?p=18</guid>
		<description><![CDATA[Steps:
1) create simple web application (here i am use the asp.net 2.0).
2) In that application put the below code in the designer view.
&#60;table&#62;
&#60;tr&#62;
&#60;td&#62;
Enter User Name
&#60;/td&#62;
&#60;td&#62;
&#60;asp:TextBoxID=&#8221;txtUserName&#8221;runat=&#8221;server&#8221;onblur=&#8221;return HighLightErrorMsg(this.id,&#8217;lblUserError&#8217;,'red&#8217;);&#8221;&#62;&#60;/asp:TextBox&#62;&#60;/td&#62;
&#60;td&#62;
&#60;divstyle=&#8221;visibility: hidden; background-color: Red; width: 200px;&#8221;id=&#8221;lblUserError&#8221;&#62;
Please Enter UserName
&#60;/div&#62;
&#60;/td&#62;
&#60;/tr&#62;
&#60;tr&#62;
&#60;td&#62;
Enter Password
&#60;/td&#62;
&#60;td&#62;
&#60;asp:TextBoxID=&#8221;txtPassword&#8221;runat=&#8221;server&#8221;onblur=&#8221;return HighLightErrorMsg(this.id,&#8217;lblPassword&#8217;,'red&#8217;);&#8221;&#62;&#60;/asp:TextBox&#62;
&#60;/td&#62;
&#60;td&#62;
&#60;divstyle=&#8221;visibility: hidden; background-color: Red; width: 200px;&#8221;id=&#8221;lblPassword&#8221;&#62;
Please Enter Password
&#60;/div&#62;
&#60;/td&#62;
&#60;/tr&#62;
&#60;tr&#62;
&#60;tdcolspan=&#8221;2&#8243;&#62;
&#60;center&#62;
&#60;asp:ButtonID=&#8221;btnSubmit&#8221;runat=&#8221;server&#8221;OnClick=&#8221;btnSubmit_Click&#8221;Text=&#8221;Submit&#8221;
OnClientClick=&#8221;return CheckControl();&#8221; /&#62;
&#60;/center&#62;
&#60;/td&#62;
&#60;/tr&#62;
&#60;/table&#62;
3) In that page write below javascript.
&#60;script language="javascript"&#62;

  function CheckControl()
{
//get the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=18&subd=amitpatriwala&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Steps:</p>
<p>1) create simple web application (here i am use the asp.net 2.0).</p>
<p>2) In that application put the below code in the designer view.</p>
<p><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">table</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
</span>Enter User Name<br />
<span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span><span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtUserName&#8221;</span><span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span><span style="color:red;">onblur</span><span style="color:blue;">=&#8221;return HighLightErrorMsg(this.id,&#8217;lblUserError&#8217;,'red&#8217;);&#8221;&gt;&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">div</span><span style="color:red;">style</span><span style="color:blue;">=&#8221;visibility: hidden; background-color: Red; width: 200px;&#8221;</span><span style="color:red;">id</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">=&#8221;lblUserError&#8221;&gt;<br />
</span>Please Enter UserName<br />
<span style="color:blue;">&lt;/</span><span style="color:#a31515;">div</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
</span>Enter Password<br />
<span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span><span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtPassword&#8221;</span><span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span><span style="color:red;">onblur</span><span style="color:blue;">=&#8221;return HighLightErrorMsg(this.id,&#8217;lblPassword&#8217;,'red&#8217;);&#8221;&gt;&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">div</span><span style="color:red;">style</span><span style="color:blue;">=&#8221;visibility: hidden; background-color: Red; width: 200px;&#8221;</span><span style="color:red;">id</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">=&#8221;lblPassword&#8221;&gt;<br />
</span>Please Enter Password<br />
<span style="color:blue;">&lt;/</span><span style="color:#a31515;">div</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">td</span><span style="color:red;">colspan</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">=&#8221;2&#8243;&gt;<br />
&lt;</span><span style="color:#a31515;">center</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Button</span><span style="color:red;">ID</span><span style="color:blue;">=&#8221;btnSubmit&#8221;</span><span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span><span style="color:red;">OnClick</span><span style="color:blue;">=&#8221;btnSubmit_Click&#8221;</span><span style="color:red;">Text</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">=&#8221;Submit&#8221;<br />
</span><span style="color:red;">OnClientClick</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">=&#8221;return CheckControl();&#8221; /&gt;<br />
&lt;/</span><span style="color:#a31515;">center</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">td</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">tr</span></span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&gt;<br />
&lt;/</span><span style="color:#a31515;">table</span><span style="color:blue;">&gt;</span></span></span></p>
<p><span style="color:blue;">3) In that page write below javascript.</span></p>
<pre><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">script </span><span style="color:red;">language</span><span style="color:blue;">="javascript"&gt;</span></span></span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre><span style="font-family:times;font-size:small;">  <span style="color:blue;">function </span>CheckControl()
{
</span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//get the id of username textbox
</span><span style="color:blue;">var </span>objUserName=document.getElementById(<span style="color:#a31515;">'txtUserName'</span>).id;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//get the id of username error message
</span><span style="color:blue;">var </span>objUserError =document.getElementById(<span style="color:#a31515;">'lblUserError'</span>).id;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//get the id of password textbox
</span><span style="color:blue;">var </span>objPassword =document.getElementById(<span style="color:#a31515;">'txtPassword'</span>).id;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//get the id of password error message
</span><span style="color:blue;">var </span>objPasswordError =document.getElementById(<span style="color:#a31515;">'lblPassword'</span>).id;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//check control and highlight message
</span><span style="color:blue;">if</span>(HighLightErrorMsg(objUserName,objUserError,<span style="color:#a31515;">'red' </span>)==<span style="color:blue;">false</span>)
{
<span style="color:blue;">return false</span>;
}
<span style="color:blue;">else if</span>(HighLightErrorMsg(objPassword,objPasswordError,<span style="color:#a31515;">'red'</span>)==<span style="color:blue;">false</span>)
{
<span style="color:blue;">return false</span>;
}
<span style="color:blue;">return true</span>;
}

</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//id--&gt;control to validate
//errorid --&gt; div to display error message
//color --&gt; error color
</span><span style="color:blue;">function </span>HighLightErrorMsg(id,errorid,color)
{
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//check the control value
</span><span style="color:blue;">if</span>(document.getElementById(id).value !=<span style="color:#a31515;">""</span>)
{
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//hide the error message
</span>document.getElementById(errorid).style.visibility =<span style="color:#a31515;">"hidden"</span>;
<span style="color:blue;">return true</span>;
}
<span style="color:blue;">var </span>bkcolor=color;
<span style="color:blue;">if</span>(bkcolor==<span style="color:#a31515;">'red'</span>)
bkcolor =<span style="color:#a31515;">'green'</span>;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:blue;">else
</span>bkcolor =<span style="color:#a31515;">'red'</span>;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//set the background color
</span>document.getElementById(errorid).style.backgroundColor =bkcolor;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//visibility set
</span>document.getElementById(errorid).style.visibility =<span style="color:#a31515;">"visible"</span>;
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//if error at that time focus on the particular control
</span>document.getElementById(id).focus();
</span></span><span style="font-size:small;"><span style="font-family:times;"><span style="color:green;">//every 5 sec call and change the background color
</span>window.setTimeout(<span style="color:#a31515;">"HighLightErrorMsg('"</span>+ id + <span style="color:#a31515;">"','"</span>+ errorid +<span style="color:#a31515;">"','"</span>+bkcolor+<span style="color:#a31515;">"');"</span>,500);
<span style="color:blue;">return false</span>;
}

<span style="color:blue;">&lt;/</span><span style="color:#a31515;">script</span><span style="color:blue;">&gt;</span></span></span></pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>Thanks</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/amitpatriwala.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/amitpatriwala.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amitpatriwala.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amitpatriwala.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amitpatriwala.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amitpatriwala.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amitpatriwala.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amitpatriwala.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amitpatriwala.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amitpatriwala.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amitpatriwala.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amitpatriwala.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amitpatriwala.wordpress.com&blog=2616360&post=18&subd=amitpatriwala&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://amitpatriwala.wordpress.com/2008/04/16/hightlight-error-message-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c12ba624e5155b632d14a31227425a46?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">patriwala</media:title>
		</media:content>
	</item>
	</channel>
</rss>