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" %>
<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")
		return false

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

Recommended Answers

All 2 Replies

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...

Member Avatar
if (document.frm.t1.value==/^[a-zA-Z]+\s[a-zA-Z]+$/)
  {;return true;}
  {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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.