Feeds:
Posts
Comments

Archive for the ‘Javascript’ Category

Auto Growing TextArea

Ehsan was telling me about the litte, simple and useful control.  All of us already seen that control in facebook chatting window. that textboox automatically bacome bigger according to the text written in the textbox.

Here is the demo of that JQuery http://www.aclevercookie.com/demos/autogrow_textarea.html

I have tested that in asp.net TextBox it works. Here is my code in asp.net for auto growing textbox.

You should download JQuery and JQuery Auto Grow to use it.

<script type=”text/javascript” src=”jquery-1.3.2.js”></script>
<script type=”text/javascript” src=”jquery.autogrow.js”></script>
<script type=”text/javascript”>
$(document).ready(function() {
$(‘.expanding’).autogrow();
});

<style type=”text/css”>
.expanding {line-height: 18px;}
</style>

<asp:TextBox ID=”myTxt” runat=”server” CssClass=”expanding” AutoPostBack=”false” TextMode=”MultiLine”></asp:TextBox>

Advertisements

Read Full Post »

I needed to access every cell of a GridView in Client Side in one of my application, so needed to call javascript from GridView Cell. Actually I have a Dropdownlist , select any of the item from the dropdownlist will change the value of the same row in a different cell and will change the GridView footer row  value.

Here is a article showing how to access row and cell of a gridview from client site.
http://weblogs.asp.net/ashrafurrahaman/archive/2009/02/26/javascript-for-gridview-row-level.aspx

Read Full Post »

fun with Javascript

I faced a problem to call 2 methods at the same time from body. and the solution is very simple. I wrote a script block at the end of the page look like that.

<SCRIPT LANGUAGE=”JAVASCRIPT”>

if(document.body.onload)

{

var existingOnLoad = document.body.onload;

document.body.onload = function()

{

existingOnLoad();

MyOwnMethod();

}

}

</SCRIPT>

Read Full Post »

here is the script not ot allow right click in browser

<script language=”Javascript1.2″>
am = “NO RIGHT CLICK ALLOWED!”;
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName==”Netscape”
bIE = navigator.appName==”Microsoft Internet Explorer”
function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
  alert(am)
     return false;
   }
}
document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;
</script>

Read Full Post »