JavaScript - how to verify that two email addresses on a form are an exact match

Asked By steven
02-Sep-10 07:14 AM
Hi, how do i verify that two email addresses on an form are an exact match using javascript?
  Sasha Kotlo replied to steven
02-Sep-10 07:24 AM
well it's easy..

var email1 = document.getElementById("email1").value;
var email2 = document.getElementById("email2").value;

if(email1 == email2)
{
alert("Match");
}
else
{
alert("No Match");
}

Simple right?

Regards.
  Goniey N replied to steven
03-Sep-10 06:26 AM
-- First Of All You Have To Check That Is Given Value Is Email Address Or Not?
-- If Yes Then Compare & If No Then Display Message That Enter Email Address...

-- Code For Checks Of Email Address...

01.<script type="text/javascript" >
02.  function CheckEmail()
03.  {
04.    var strEmail1 = document.getElementById('<%=TextBox1.ClientID%>').value;
05.    var strEmail2 = document.getElementById('<%=TextBox2.ClientID%>').value;
06.    var objRegex = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
07. 
08.    if((objRegex.test(strEmail1) == true) && (objRegex.test(strEmail2) ==true))
09.    {
10.      if(strEmail1 == strEmail2)
11.      {
12.        //Here Both Are Exact Match, So Write Here Your Code...
13.        alert("Both Values Are Exact Match.");
14.      }
15.      else
16.      {
17.        alert("Both Values Are Not Exact Match.");
18.      }
19.    }
20.    else
21.    {
22.      alert("Please Enter Email Address.");
23.    }
24.  }
25.</script>


01.<body>
02.  <form style="" id="form1" runat="server">
03.  <div>
04.    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
05.    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
06.    <asp:Button ID="Button1" OnClientClick="CheckEmail()" runat="server"OnClick="Button1_Click" Text="Click Here" />
07.  </ div>
08.  </form>
09.</body>



-- For More Clear View See Below Images :



-- Here I Enter Same Value But In Different Case :




-- Here I Entered Both Same Value :



-- Here I Entered Different Value that Email Address :




-- It Will Work 100%.....

-- Hope This Will Help You...
  steven replied to Goniey N
03-Sep-10 08:36 AM
thanks.
Create New Account
help
org Code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript Anyone can file Firefox bugs. You just have to create an account on their bug of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. If you can easily repro this of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. Well, I tried to use the of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. If you run the process under of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. I am glad that you have of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. The graphic driver and usb driver of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. Yep, and the suggestions I heard of code examples and expert discussions on C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript, organized by major topics of language, tools, methods, techniques. That is what I smell. Exactly
InnerTEXT (1) Python (1) Perl (1) Ruby (1) Use Flash. With CS3 it is a match made in heaven for applications on the web. Firstly HTA is a red-herring. HTA to HTAs OK, some HTA techniques are (thankfully!) forbidden for web use. Find a good JavaScript tutorial. (M$oft isn't - they're too busy pushing proprietary tweaks, not standards). Study two things: How to do simple visual effects by dynamic CSS changes, and using JavaScript's .SetTimeout() method to drive things with intervals. The rest is just a bit of and legwork in coding your scripts. If you get stuck, try asking in comp.lang.javascript Don't use VBScript. Don't ever use it for web work (client-side or server-side). It's an ugly language, anything it can do, JavaScript or JScript can do better. Mostly though, using J(ava)Script gives you some hope in a non-VBS group. :) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Did you insert this for some purpose? Not required for JavaScript to work on IE. . . - - Take care, Jonathan - -- -- -- -- -- -- -- -- -- LITTLE WORKS STUDIO http: / / www.LittleWorksStudio.com Did span> Thanks Mike! Your code works. Now the question is, how do I insert your javascript code into the HTA that I referred to: http: / / www.microsoft.com / technet / scriptcenter / resources / qanda / jan08 / hey0130. = mspx The resulting HTA needs to have both VBScript and javascript code. What I'm looking for is the HTA to have a blank span initially
are entirely random. When I use the pattern [0-9]. . [0-9] I get a match count of 1. if i use [0-9]. . . I get 2 as a match count. I want my regexp to match against 1234, 2345, 3456, 4567 and get a count of 4? Can someone tell me the correct pattern to use? (without counting on the surrounding characters). VBScript Discussions Match.SubMatches (1) SonOfRFC1036 (1) Match.Value (1) RegEx.IgnoreCase (1) RegExM.Execute (1) RegExR.Pattern (1) RegExM.Pattern (1) RegExR Mid(sMatch, i + 1, 4) Next wsh.echo Join(aMatches, vbnewline) else wsh.echo "No match found" end if ' Finds the first match, only Function RegExpFind(patrn, strng) Dim regEx, Matches ' Define variables. Set regEx = 3D New RegExp applicability. Set Matches = 3D regEx.Execute(strng) ' Execute search. RegExpFind = 3D Matches(0).Value ' Return match End Function It get the answer you were looking for in this case. I does
any one tell me the difference between Java Script and Vb script in a sentence JavaScript is a scripting language that works in all browsers whereas VBScript is a scripting language IE. For detailed info, check - http: / / w3schools.com / vbscript / http: / / w3schools.com / js / Comparison of JavaScript and VBScript Similarities 1. Both languages are easy to learn and do not require any server loads 4. Both can abuse and run malicious scripts on clients' machines Differences 1. JavaScript is the default scripting language for browsers but VBScript must be specified as the scripting language. 2. JavaScript has cross-platform support from all popular browsers while VBScript is supported MS IE only VBScripters would thus loose a sizable audience. 3. One of the most significant issues with JavaScript is that there were different releases of the language since its inception (version 1.0 not necessarily work on another. More testing would be necessary thus, development time increases. 4. JavaScript is case sensitive but VBScript is not this would not be prone to as many syntax errors.< 5. JavaScript uses the same character for concatenation as it does for addition (the + character) while the concatenating character is used in VBScript. This is another source of errors in JavaScript. if you want to know some more , Javascript -vs- VBScript, pros and cons compared http
www.w3.org / 1999 / xhtml " > < head runat = "server" > < title > Untitled Page< / title > < script type = "text / javascript" > function pageLoad() { } < / script > < / head > < body > < form id = "form1" runat = "server" > < div > < asp:ScriptManager ID = "ScriptManager1 Buddies]" ValidateRequest = "false" EnableEventValidation = "false" %> <asp:Content ID = "Content1" ContentPlaceHolderID = "ContentPlaceHolder1" Runat = "Server"> <script language = "javascript" type = "text / javascript" src = ". . / Css / dhtmlwindow1.js"> < / script> <script language = "javascript" type = "text / javascript"> function invclose() { dhtmlwindow.close('dwnloadbackup'); / / Div with resize return false; } function openinvitediv() { document.location.href 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 textCounter(field 006699" ForeColor = "White" HorizontalAlign = "Left"> < / HeaderStyle> <ItemTemplate> < / ItemTemplate> <asp:CheckBox ID = "chkBxHeader" runat = "server" onclick = "javascript:HeaderClick(this);" / > < / HeaderTemplate> <ItemStyle BackColor = "LemonChiffon" Width = "1px" BorderColor = "Black" HorizontalAlign = "Center"> < / ItemStyle> <HeaderStyle BorderStyle left"> <asp:ImageButton ID = "ImageButton8" runat = "server" ImageAlign = "AbsBottom" ImageUrl = ". . / Images / fence-s.png" OnClientClick = "javascript:return fence();" / > <asp:Button style = "BACKGROUND-IMAGE: none; cursor:hand; BORDER-TOP-STYLE: none; BORDER