| <script type="text/javascript"> | |
| String.prototype.trim = function() { a = this.replace(/^\s+/, ''); return a.replace(/\s+$/, ''); }; | |
| function ascii_value (c) | |
| { | |
| // restrict input to a single character | |
| c = c . charAt (0); | |
| // loop through all possible ASCII values | |
| var i; | |
| for (i = 0; i < 256; ++ i) | |
| { | |
| // convert i into a 2-digit hex string | |
| var h = i . toString (16); | |
| if (h . length == 1) | |
| h = "0" + h; | |
| // insert a % character into the string | |
| h = "%" + h; | |
| // determine the character represented by the escape code | |
| h = unescape (h); | |
| // if the characters match, we've found the ASCII value | |
| if (h == c) | |
| break; | |
| } | |
| return i; | |
| } | |
| function isNameKey(evt) | |
| { | |
| var charCode = (evt.which) ? evt.which : event.keyCode | |
| if (!((charCode >= 97 && charCode <= 122)|| (charCode >= 65 && charCode <= 90) ||(charCode==32)||(charCode==39)||(charCode==08) ||(charCode==09)) ) | |
| { | |
| alert("Please Enter Valid Character") | |
| return false; | |
| } | |
| return true; | |
| } | |
| function fnlogin() | |
| { | |
| var email=new String(); | |
| var textname=new String(); | |
| txtname=document.getElementById("ctl00_ContentPlaceHolder1_textname").value | |
| email=document.getElementById('ctl00_ContentPlaceHolder1_textemail').value; | |
| if (txtname.trim()=="") | |
| { | |
| alert("Please Enter the name ") | |
| document.getElementById("ctl00_ContentPlaceHolder1_textname").focus(); | |
| return false | |
| } | |
| else | |
| { | |
| var t_len2; | |
| var str3=document.getElementById("ctl00_ContentPlaceHolder1_textname").value; | |
| t_len2= str3.length; | |
| for (var iCount = 0; iCount < t_len2; iCount++) | |
| { | |
| str4 = str3.substring(iCount, iCount+1); | |
| var charCode = ascii_value(str4); | |
| if (!((charCode >= 97 && charCode <= 122) || (charCode >= 65 && charCode <= 90) || (charCode == 32) || (charCode == 39))) | |
| { | |
| document.getElementById("ctl00_ContentPlaceHolder1_textname").focus(); | |
| alert("Please Enter Valid Name"); | |
| return false; | |
| break; | |
| } | |
| } | |
| } | |
| if(email.trim()=="") | |
| { | |
| alert("Please enter email id"); | |
| document.getElementById('ctl00_ContentPlaceHolder1_textemail').focus(); | |
| return false; | |
| } | |
| else | |
| { | |
| if (!((/^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}$/.test(email))||(/^[a-zA-Z0-9_-]+[.]+[a-zA-Z0-9_-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}$/.test(email))||(/^[a-zA-Z0-9_-]+[.]+[a-zA-Z0-9_-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}$/.test(email))||(/^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}$/.test(email))||(/^[a-zA-Z0-9_-]+[.]+[a-zA-Z0-9_-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}$/.test(email)))) | |
| { | |
| alert("Please Enter a Valid Email ID."); | |
| document.getElementById('ctl00_ContentPlaceHolder1_textemail').focus(); | |
| return false | |
| } | |
| } | |
| if(document.getElementById("ctl00_ContentPlaceHolder1_textproble").value=="") | |
| { | |
| alert("Please Enter the Problem/Suggestion ") | |
| document.getElementById("ctl00_ContentPlaceHolder1_textproble").focus() | |
| return false | |
| } | |
| else | |
| { | |
| var textproble=document.getElementById("ctl00_ContentPlaceHolder1_textproble").value; | |
| if(textproble.trim()=="") | |
| { | |
| var tadd_len2= textproble.length; | |
| for (var iCount = 0; iCount < tadd_len2; iCount++) | |
| { | |
| var str4 = textproble.substring(iCount,iCount+1); | |
| //alert(str4); | |
| var charCode = ascii_value(str4); | |
| //alert(charCode); | |
| //Response.Write(asc_num.ToString() + " "); | |
| if (charCode==32) | |
| { | |
| alert("please enter valid problem."); | |
| document.getElementById('ctl00_ContentPlaceHolder1_textproble').focus(); | |
| return false; | |
| break; | |
| } | |
| break; | |
| } | |
| // return false; | |
| } | |
| } | |
| var varlen=document.getElementById('ctl00_ContentPlaceHolder1_textproble').value; | |
| if(varlen.length>7000) | |
| { | |
| alert("Please enter maximum 7000 characters!!"); | |
| return false | |
| } | |
| } | |
| </script> | |
| <script type="text/javascript"> | |
| function ok(sender, e) | |
| { | |
| $find('ModalPopupExtenderLogin').hide(); | |
| __doPostBack('LoginBtn', e); | |
| } | |
| function okJoin(sender, e) | |
| { | |
| $find('ModalPopupExtenderSignup').hide(); | |
| __doPostBack('JoinBtn', e); | |
| } | |
| function OnKeyPress(args) | |
| { | |
| if(args.keyCode == Sys.UI.Key.esc) | |
| { | |
| $find("ModalPopupExtenderLogin").hide(); | |
| } | |
| } | |
| function body_onkeydown() | |
| { | |
| if(event.keyCode==13 || event.keyCode==27) | |
| { | |
| var _defaultButtonName=getDefautButtonName( event.keyCode==13 ? "submitButton" : "cancelButton"); | |
| var frm=document.forms[0]; | |
| if(frm && document.all(_defaultButtonName)) | |
| { | |
| document.all(_defaultButtonName).click(); | |
| } | |
| } | |
| } | |
| function getDefautButtonName(className) | |
| { | |
| var _defaultButtonName=""; | |
| var children = document.getElementsByTagName("input"); | |
| for (var i = 0; i < children.length; i++) | |
| { | |
| var child = children[i]; | |
| var btnAction = child.buttonAction; | |
| if(btnAction == className) | |
| { | |
| _defaultButtonName = child.id; | |
| break; | |
| } | |
| } | |
| return _defaultButtonName; | |
| } | |
| function launchModal2() | |
| { | |
| //alert("helo"); | |
| var mpsh=$find("ModalPopupExtender1"); | |
| mpsh.show(); | |
| } | |
| </script> |
Jan 6, 2011
Sample java script
Subscribe to:
Post Comments (Atom)
-
<body> <form id="form1" runat="server"> <img class="RibbonL" src="Imag...
-
Remarks This property specifies the appearance of the embedded Windows Media Player. When uiMode is set to "none", "mini...
-
Partial Class Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Lo...
What is the use of n-tier architecture and 3-tier architecture?
how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...
No comments:
Post a Comment