使用HTML寫一個簡單的跳轉登錄頁面

最近在學習前端的知識,於是就想寫一個簡單的頁面跳轉,必須是勾選了“我同意”這個選項以後才能跳轉,否則不能,不廢話,直接上代碼。

首先是第一個頁面:testlogin1.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    type="text/javascript"
    src="http://localhost:63342/python 文件/testlogin.html"
</script>
<body bgcolor="#ffffff" onload="loadedvar=true;">
<form name="terms" action="http://localhost:63342/python 文件/testlogin.html" method="get">
    我同意: <input type="checkbox" name="agree" value="ON">
    <input onclick="if (loadedvar) {if (document.terms.agree.checked) {document.terms.submit();} else {window.alert('kumikoda提示您,必須先同意才能跳轉')}} else {window.alert('請稍等...')}" type="button" value="繼續">
    <input type="button" value="退出" onclick="document.location.href='http://localhost:63342/python 文件/testlogin.html';" >
</form>
</body>
</html>

然後是第二個頁面testlogin.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登錄</title>
<style>
#login {
    width: 290px;
    height: auto;
    overflow: hidden;
    border: solid 1px #CCCCCC;
}
#login_title {
    width: 100%;
    height: 40px;
    line-height: 40px;
    background-color: #F60;
    text-align: center;
}
.line {
    width: 250px;
    height: 30px;
    line-height: 30px;
    margin-left: 20px;
    text-align: center;
    font-family: 楷體;
}
.line input {
    width: 150px;
}
.line a {
    font-size: 14px;
    color: black;
}
.line span {
    color: #F00;
}
#log_submit {
    display: block;
    width: 200px;
    height: 30px;
    margin-left: 45px;
    margin-top: 15px;
    margin-bottom: 5px;
}
</style>
</head>


<body>
<form action="#" method="post">
  <div id="login">
    <div id="login_title">登&nbsp;錄</div>
    <div class="line"><span id="msg"></span></div>
    <div class="line">賬號&nbsp;&nbsp;
      <input name="username" type="text" placeholder="賬號/手機/郵箱" />
    </div>
    <div class="line">密碼&nbsp;&nbsp;
      <input name="password" type="password" placeholder="請輸入密碼" />
    </div>
    <input id="log_submit" type="submit" value="登錄">
    <div class="line"><a href="#">找回密碼</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">註冊賬號</a></div>
  </div>
</form>
</body>
</html>

最終結果如下:

wKiom1bvs-DgFltyAAAeHvquMVg651.png

wKiom1bvs-Gx1QQcAAAkxS_kL-w171.png

呵呵,寫的不好的地方,高手勿噴。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章