PROGRAM USING JAVASCRIPT AND DHTML
PROGRAM
Login page (login.html)
Login page (login.html)
<html>
<head>
<title>LOGIN</title>
<script
type="text/javascript">
function
validate()
{
var
user_login=document.forms["myForm"]["user_login"].value;
var
password=document.forms["myForm"]["password"].value;
if(user_login=="" || password=="")
{
alert("Please enter your user login and password correctly");
return
false;
}
return(true);
}
<!--
//Form
validation code will come here.
//-->
</script>
</head>
<body>
<form
action="web2.html" name="myForm"
onsubmit="return(validate());">
<h1>Login Page</h1>
<br></br>
User
Login:<input type="text" name="user_login">
<br></br>
Password:<input type="password"
name="password">
<br></br>
<input type="submit"
value="LOGIN">
</form>
</body>
</html>
Registration form (web2.html)
<html>
<head>
<title>form validation</title>
<script
type="text/javascript">
function
validate()
{
var
email=document.getElementById('email').value;
var
name=document.getElementById('name').value;
var
age=document.getElementById('age').value;
var
mob_number=document.getElementById('datetime').value;
var
datetime=document.getElementById('datetime').value;
if(email=="" || name=="" || age=="" ||
mob_number=="" || datetime=="")
{
alert("Please enter all correct detail in the given form");
return
false;
}
return(true);
}
<!--
//Form
validation code will come here.
//-->
</script>
</head>
<body>
<form
action="submit.html" name="myForm"
onsubmit="return(validate());">
<h1>Registration Form</h1>
<br></br>
Name:<input
type="text" name="name" id="name">
<br></br>
Email:<input type="text" name="email"
id="email">
<br></br>
Mobile
Number:<input type="text" name="mob_number"
id="mob_number">
<br></br>
Age:<input
type="text" name="age" id="age">
<br></br>
DAO:<input
type="text" name="datetime" id="datetime">
<br></br>
Payment_option:<select name="Payment_option">
<option
value="-1" selected>[choose yours]</option>
<option
value="1">CREDIT</option>
<option
value="2">DEBIT</option>
</select>
<br></br>
<input
type="submit" value="SUBMIT">
</form>
</body>
</html>
Submit (submit.html)
<p style="color:blue; text_algin:center;font_Size:sopx">
Registered successfully.</p>
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home