problem in java script

problem in java script

View Answers

October 15, 2008 at 10:20 AM

Hi,


<html>
<title>Email validation in JavaScript</title>
<head>
<script type="text/javascript">

function checkEmail(email) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
return (true)
}
alert("Invalid email address.Please Enter again.")
return (false);
}

function validateForm(theForm){

if(theForm.email.value==""){
alert("Please enter email!");
objForm.email.focus();
return false;
}

if(!checkEmail(theForm.email.value)){
theForm.email.focus();
return false;
}

return true;
}
</script>

</head>
<body>
<br>
<br>
<center>
<table border="1" width="500px" bgcolor="lightblue">
<tr>
<td width="100%">
<form method="POST" action="" onsubmit="return validateForm(this);">

<h2 align="center">Email validation</h2>
<table border="0" width="400px" cellspacing="2" cellpadding="3">

<tr>
<td width="50%"><b>User Name:</b></td>
<td width="50%"><input type="text" name="userid" size="25"></td>
</tr>
<tr>
<td width="50%"><b>Email ID:</b></td>
<td width="50%"><input type="text" name="email" size="35"></td>
</tr>
</table>
<center>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</center>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>

-----------------------------------------

Thanks.









Related Tutorials/Questions & Answers:
script problem - Java Beginners
script problem  Even though both .js file and .jsp file present in the same location,script is not working in mozilla but working in Internet... what i have written present in same location. but the script
java script code problem - Java Beginners
java script code problem  Dear sir, my problem is that, suppose i've two HTML files(with java script), out of them one has function EMPLOYEE_DETAILS() i want to call this EMPLOYEE_DETAILS() fuction to another Html file, how
Advertisements
Jsp/java-script, spring combination problem
Jsp/java-script, spring combination problem   Hi Friends....... I am developing one application using jsp,spring,java script,hibernate,Pojo There is one Jsp form on that I want data as location and ward wise; There is two
Java Script Code Problem - JSP-Servlet
Java Script Code Problem  how to concatenate html table values(there are 3 rows,each row contains 3 fields) into variable and display it using javascript  Hi Friend, Try the following code: document.write
problem in java script - Java Server Faces Questions
problem in java script  hi deepak i want to apply validation on email field of form nd i make this prog. but this is not working plz send me solution of my prob asap . ss function validate() { var error=false
Ant Script Problem - Ant
Ant Script Problem  I refer roseindia's(www.roseindia.net) Ant tutorial. According to that I tried to create tables using Ant script, but it throws... this Problem? Regards, K.Senthuran   Hi friend, Your Problem
Java Script
Java Script  why we are using java script
Java script
Java script  Source code for capturing the screen using Java Script
Java Script
Java Script  Hi, Any one please share a code to swap the 2strings using java script
Java Script
Java Script  What is Java Script? How to learn Java Script?   Hi Java Script is client side programming language. It runs on browser.... You can learn Java Script from our JavaScript - JavaScript Tutorial pages
java script
java script  how to write a Java script program to enter number in two text fields and then automatically display the total in another text field
Java script
Java script  a java script code for accept 10 numbers from the user and print in the descending order without using sort method
java script
java script  Hi, Any one please tell me how, to store below elements in an array using java script 12,13,14,a,b,xyz
Java Script.
Java Script.  Hi Sir, The below java script code is not working in Google chrome can yo give me the solution as soon as possible. <script type="text/javascript"> function setValue(){ var val=""; var frm
Java Script.
Java Script.  Hi Sir, The below java script code is not working in Google chrome can yo give me the solution as soon as possible. <script type="text/javascript"> function setValue(){ var val=""; var frm
Java Script.
Java Script.  Hi Sir, The below java script code is not working in Google chrome can yo give me the solution as soon as possible. <script type="text/javascript"> function setValue(){ var val=""; var frm
Java Script.
Java Script.  Hi Sir, The below java script code is not working in Google chrome can yo give me the solution as soon as possible. <script type="text/javascript"> function setValue(){ var val=""; var frm
Java Script
Java Script  Hello Sir, Is it possible to select only current date from datetimepicker in struts2 through java script validation. Means when i select.... Try to send me java script validation code for this purpose that user won't
Java Script.
Java Script.  The below code is nit working in Google chrome can any one tell me the solution as soon as possible. <script type="text/javascript"> <!-- function setValue(){ var val=""; var frm
Java Script.
Java Script.  Hi i want to submit two form using javascript.The below code submitting two forms in server but its not working in browser like chrome and firefox am struggling for many days give me solution as soon as possible
java script
java script  how will you identify whether the number entered by the user has two digits or three digits.Assuming that the user enters only a three digit or two digit number.   <HTML> <HEAD> <SCRIPT
java script
java script  write a java script code which provide a menu for user which will enable him/her to either add or subtract or multiply or divide two numbers and produce the corresponding result.   <html> <
Problem submitting a struts form containing a dojo script - Struts
Problem submitting a struts form containing a dojo script  Hello there, Is there any way to make use of dojo with struts 1 ? Actually, I'm facing a problem submitting a struts form containing a dojo script for a dynamic
java script
java script  when you click a button how will you change the background color of a web page
java script
java script  I want to display set of radio buttons after i select one option of the combobox
java script
java script  what is the use of getElementById() method in jsp. and give me its full knowledge with a example
java script
java script  hi deepak, i have small doubt in the date ranges that when i select the date range then it display on the text boxes. example:suppose i select the weekly date range then the dates are display on the text boxes up
Java Script
Java Script  I want to display an error message for the validation of email at the top of the page in red font i want to use java scripts but i dont want to use alert box what i need to do   <html> <script>
Java script - Development process
java script code for that its working in IE not Fire Fox, actually...Java script  Dear Sir/Mdm I have a probem, when any user close... my problem and which will work both IE n FF. Regards Amit
Merging of java script with servlet program
Merging of java script with servlet program  how can we merge the java script with the any servlet program for making web application intractive.Is there any program you have.\please help me to sove out this problem
script code - Java Beginners
script code  hi, thanks for ur fast reply. plzz, give me a sample code for PHP function under script tag. regards, sakthi  Hi friend, Code to help in solving the problem : Hello PHP World
Java Script location.replace method
Java Script location.replace method  Hi, What does `Print `{<SCRIPT LANGUAGE="JavaScript"> location.replace("} & urlpop & {","BOTTOM") </SCRIPT>} this mean as this is written in an Lotus Script agent and I
java script - JSP-Servlet
java script  what is the use of hidden fields in java script? if a page has 3 links the first link should be enabled and others should be disabled... problem then send me source code and explain in detail
defining numbers in Java Script
defining numbers in Java Script  Explain about defining numbers in Java Script
Java script in servlet
Java script in servlet  Hi. How to use javascript inside java servlet? Thanks in advance
Java Script Program
Java Script Program  <%-- Document : index Created... are available in the Sun Java System Application Server 9.1 logs. Sun Java System Application Server 9.1 Where Is The Problem? Please Help
Java Script Program
Java Script Program  <%-- Document : index Created... are available in the Sun Java System Application Server 9.1 logs. Sun Java System Application Server 9.1 Where Is The Problem? Please Help
java script code
java script code  Hi Deepak, Firstly wanna share the problem em facing: working with servlet and jsp for my project. I have 3 main jsp pages which interacts with user for accepting user input and supply them
form to java script conversion
form to java script conversion  I am using a form one more form cotain a piece of code . how to convert it to java script to function it properly..." name="ie" value="UTF-8" /> <input type="text" name="q" size="55" />
java script,java - Java Beginners
java script,java  hi deepak i have one image is there.beside the image ihave 11 digital numbers is there.that digital numbers we can drag... Friend, Please clarify your problem. Thanks
qunit jquery with java script
qunit jquery with java script  hi deepak How to write a javascript code and do the test by using qunit sample application and as I am new to testing how to setup the environment for java script testing? where should I run
java script - Development process
java script  how could i devlop code for create widget. i need to generate java script that if paste to any other web site will generate the widget. a widget can contain image text video or combination
java script - Ajax
java script  i know basic of java script. i want to gain more knowledge in java script. please send a link or guidelines to me. and ajax also my mail address is [email protected]  Hi friend, Javascript
java script - JSP-Servlet
java script  hello buddy......i m new to here....please help me to solve my problem i have a jsp page with pre populated value comming from other jsp.....ones i submitted i have to clear that page and i have to submite
selectoptions errors in java script
selectoptions errors in java script  hi, in my web page when I select the color of the image it displays that particular color but when i again opt the select option it displays errors message. How do I rectify this problem
script error - Java Beginners
script error  hi, Is it possiple to use PHP function under the script tag. plz help me. thank u in advance. regards, sakthi  Hi Friend, Yes It is possible to use PHP function under the script Tag. Thanks
java script - Ajax
java script  I have a java script function and getting "pitems" list values in select, and i want to send the values in the form of List to my CommonService class. Below code is not working... function f_getPop
java script - Development process
java script  hi.. how to get previous and next buttons inside the table in the same page as like our mails in the inbox.  Hi Friend, Try the following code: ID Name Address Contact
Java Script Help
Java Script Help  I have written a countdown timer using javascript... help --- <html> <head> </head> <script language....' window.location = 'crdtd.php?q=b
java script in jsf - Java Server Faces Questions
java script in jsf  How to populate a text value for the list box using java script? I have a problem in populating the text value for the list box... and some exceptions have occured .can u pls sort out my problem

Ads