אתה יכול לבדוק האם הסיסמא שהלקוח הכניס ל-textbox שווה לסיסמא מסיומת (נגיד: SecretCode007), ורק אז הלקוח יוכל להיכנס לדף המבוקש. אם הסיסמא שונה אז להדפיס alert שיודיע לו שאין גישה לדף זה, או לכוון אותו לדף הרשמה או משהו….
<script> document.getElementById("button").onclick = function () { var password = "1234"//שנה את הסיסמא var text = document.getElementById('password').value; if (text == password) { window.location.href = "page.html";//שנה את הכתובת }
2 תשובות
אתה יכול לבדוק האם הסיסמא שהלקוח הכניס ל-textbox שווה לסיסמא מסיומת (נגיד: SecretCode007), ורק אז הלקוח יוכל להיכנס לדף המבוקש. אם הסיסמא שונה אז להדפיס alert שיודיע לו שאין גישה לדף זה, או לכוון אותו לדף הרשמה או משהו….
<html>
<head>
</head>
<body>
<form action="main.html" method="post" style="visibility:hidden" id="word">
<input type="password" id="password"/>
<input type="button" id="button" value="כנס"/>
</form>
<script>
document.getElementById("button").onclick = function () {
var password = "1234"//שנה את הסיסמא
var text = document.getElementById('password').value;
if (text == password) {
window.location.href = "page.html";//שנה את הכתובת
}
}
</script>
</body>
</html>