0

hi
i have done a page which contains username and password,there i have to check my username and password string and authenticate that page.
here is my code.

<%@ page language="java" %>
<html>
<head>
<title> WELCOME </title>
<script language = "Javascript">


function ValidateEmail(){
	var emailID=document.frm.t1;
        var emailID1=document.frm.t2;
	
	if ((emailID.value==null)||(emailID.value==""))
{
		alert("Please Enter A Valid User Name")
		emailID.focus()
		return false
	}

	
 if ((emailID1.value==null)||(emailID1.value=="")){
		alert("Please Enter Your Password")
		emailID1.focus()
		return false
	}
	
	return true
 }
</script>
</head>
<body>
<center/><h1>SOFTWARE ENGINEER RECRUITMENT</h1>
<marquee SCROLLDELAY=250><h4> To test your Intelligence Quotient  </h4></marquee>
<body style="background-color:#F5F5DC">
<br>
<br>
<br>
<br><br>
<br><br>
<center>
<form name="frm" method="post" action="login.jsp" onSubmit="return ValidateEmail()">
<h3>USERNAME:
<input type="text" name="t1"  /> 
<br><br>
PASSWORD:
<input type="password" name="t2" />
</h3>
<br>
<input type="submit" value="Login"/>  &nbsp&nbsp&nbsp&nbsp
<input type="reset" value="clear"/>
</form>
</html>

Edited by nav33n: Please use [code][/code] tags to wrap your code for easy readability.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

hi
in this code i have to invoke my own username which has to be used to open the next page. i need to mention that username and password in my code...

0
if (document.frm.t1.value==/^[a-zA-Z]+\s[a-zA-Z]+$/)
  {;return true;}
  else 
  {alert("Invalid name format.");return false;}

Feed this within the ValidateEmail() for both username and password.

Note: You should carefull about your naming convention, where do you get your email id? which is not relevant to your subject.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.