Set Password For Your WebPage using JavaScript
Hi friends , lets see how to set password for our webpage using JavaScript ...
Program:
This is the JavaScript Code for Setting password to your Webpage , Paste this code inside the body of your HTML Code and then Change the text in the Code "Password" to your Desired text which you want to set as Password .. If entered password is wrong it redirects to http://www.msn.com , you can decide where to go on your Interest , example Google.com or etc.
Best thing Paste this Code at the Beginning of your body , then you can Hide everything while prompt is asking Password !?!
HTML Code :
<script language='javascript'>
<!--hide
var password;
var pass1='Password';
password=prompt('Enter','');
if(password==pass1)
alert('Welcome');
else
{
window.location="http://www.msn.com";
}
//-->
</script>
<h2>Yes! Password is Correct</h2>
</body>
</html>
Program:
<script language='javascript'>
<!--hide
var password;
var pass1='password';
password=prompt('Enter','');
if(password==pass1)
alert('Welcome, Click to enter');
else
{
window.location="http://www.msn.com";
}
//-->
</script>
<!--hide
var password;
var pass1='password';
password=prompt('Enter','');
if(password==pass1)
alert('Welcome, Click to enter');
else
{
window.location="http://www.msn.com";
}
//-->
</script>
This is the JavaScript Code for Setting password to your Webpage , Paste this code inside the body of your HTML Code and then Change the text in the Code "Password" to your Desired text which you want to set as Password .. If entered password is wrong it redirects to http://www.msn.com , you can decide where to go on your Interest , example Google.com or etc.
Best thing Paste this Code at the Beginning of your body , then you can Hide everything while prompt is asking Password !?!
HTML Code :
<html>
<body>
<body>
<script language='javascript'>
<!--hide
var password;
var pass1='Password';
password=prompt('Enter','');
if(password==pass1)
alert('Welcome');
else
{
window.location="http://www.msn.com";
}
//-->
</script>
<h2>Yes! Password is Correct</h2>
</body>
</html>
you Can Execute this Code at :
Have a Nice Day
Very useful 👌👏
ReplyDelete