非常简单的登录HTML5 [英] Very Simple login HTML5
本文介绍了非常简单的登录HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试进行最简单的登录。只需要一个静态用户名/密码即可通过按钮点击进入我目录中的下一个html页面。
I'm trying to make the simplest of logins. Simply need to have a 1 static username/password to proceed to next html page in my directory via button click.
我尝试过使用这种方法,但似乎没有为我工作。
I've tried using this method but doesn't seem to work for me.
<input type="text" name="login" required pattern="user123">
<input type="text" name="password" required pattern="password1234">
任何想法都会有所帮助。如果它有帮助 http://jsfiddle.net/aHzAP/
Any ideas would be helpful. Heres the full login if it helps http://jsfiddle.net/aHzAP/
推荐答案
问题的关键是提问者希望用户名和密码是静态的。
The key to the question is that the asker wants the user name and password to be static.
为什么不使用非常简单的Javascript来执行此操作?
Why not use very simple Javascript to do this?
<input type="text" id="login" required>
<input type="text" id="password" required>
<input type="button" id="goButton" onclick="checkLoginPass()" />
<script>
var checkLoginPass = function () {
var login = document.getElementById("login").value;
var pass = document.getElementById("password").value;
if (login === "user123" && pass === "password1234") {
window.location.replace("http://www.someurlhere.com");
}
else {
//do something else;
}
}
</script>
这篇关于非常简单的登录HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文