Open Notepad --> write the following code --> Save with
login.js
<script type="text/javascript" language="javascript">
function validate()
{
var name=document.getElementById("user").value;
var pwd=document.getElementById("pwd").value;
if(name=='java' && pwd=='123')
{
alert('Login success');
}
else
{
alert('Login failed');
}
}
</script>
</head>
<body>
username:
<input type="text" id="user"/><br/>
password:
<input type="text" id="pwd"/>
<input type="button" value="login" onclick="validate()">
</body>
</html>
save with login.js and you will get one javascript icon on your system, open with browser and run it
<script type="text/javascript" language="javascript">
function validate()
{
var name=document.getElementById("user").value;
var pwd=document.getElementById("pwd").value;
if(name=='java' && pwd=='123')
{
alert('Login success');
}
else
{
alert('Login failed');
}
}
</script>
</head>
<body>
username:
<input type="text" id="user"/><br/>
password:
<input type="text" id="pwd"/>
<input type="button" value="login" onclick="validate()">
</body>
</html>
save with login.js and you will get one javascript icon on your system, open with browser and run it
so this code is ok but how to validate username and password and also how to connect the oracle database to this code
ReplyDelete