Category Archive: Java Script

Aug 21

how to disable right click in asp.net web page

In this artical i am going to explain about how to disable right click using Javascript on asp.net page <%@PageLanguage=”C#”AutoEventWireup=”true”CodeFile=”DisableRightClick.aspx.cs”    Inherits=”DisableRightClick” %> <!DOCTYPEhtmlPUBLIC“-//W3C//DTD XHTML 1.0 Transitional//EN”“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <htmlxmlns=”http://www.w3.org/1999/xhtml”> <headrunat=”server”> <title></title> <scriptlanguage=”javascript”type=”text/javascript”> function disableselect(e) { returnfalse  }  function reEnable() {  returntrue  }  //if IE4+         document.oncontextmenu = new Function(” alert (‘For security reasons, right click was disabled!’ …

Continue reading »

Nov 19

javascript validation to enter landno(eg:040-123456)

<script type=”text/javascript”>   function NumericTextBox(evt) { var charCode = evt.keyCode; if(evt.ctrlKey == true) { if(charCode == 67 || charCode == 86) { return true; } } if (charCode == 8 || //backspace charCode == 46 || //delete charCode == 13 || //enter key charCode == 189)   //hipen key { return true; } else if (charCode …

Continue reading »

Nov 19

Javascript to enter only digits in asp.net

<script type=”text/javascript”> function AllowNumsOnly(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; else return true; } </script>   <asp:TextBox ID=”txt_Qty” runat=”server” onkeypress=”return AllowNumsOnly(event);”></asp:TextBox>