HTML实现简单登录以及界面跳转

<html>      
<head>
<title>我的HTML语言
</title>
</head>
<body>
<form action="http://www.baidu.com/">                   //添加事件触发
      用户名:<input type="txt" name="username"><br>
    密码:<input type="password" name="password"><br>
    性别:<input type="radio" name="sex" value="男">男
          <input type="radio" name="sex" value="女">女<br>
    爱好:<input type="checkbox" name="like" value="篮球">篮球
         <input type="checkbox" name="like" value="足球">足球
         <input type="checkbox" name="like" value="乒乓球">乒乓球<br>
                 <input type="submit" name="确定登录">    //点击确定登录即可跳转到对应界面
                <input type="reset" name="重新填写">
</body>
</html>

  • 15
    点赞
  • 180
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
好的,我可以帮你编写一个简单html登录界面实现跳转结果。以下是示例代码: ```html <!DOCTYPE html> <html> <head> <title>Login Page</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style type="text/css"> body { background-color: #f1f1f1; font-family: Arial, Helvetica, sans-serif; } .container { background-color: #fff; border: 1px solid #ddd; border-radius: 5px; padding: 20px; margin: 50px auto; max-width: 400px; box-shadow: 0 0 10px #ccc; } input[type=text], input[type=password] { padding: 10px; margin: 5px 0 15px 0; display: block; border: none; border-radius: 5px; background-color: #f1f1f1; width: 100%; } input[type=submit] { background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; padding: 10px; font-size: 16px; cursor: pointer; width: 100%; } input[type=submit]:hover { background-color: #45a049; } </style> </head> <body> <div class="container"> <h2>Login Form</h2> <form action="#" method="post"> <label for="username"><b>Username</b></label> <input type="text" placeholder="Enter Username" name="username" required> <label for="password"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="password" required> <input type="submit" value="Login"> </form> </div> </body> </html> ``` 这个登录界面包含一个输入用户名和密码的表单,以及一个提交按钮。当用户点击提交按钮时,表单数据将被发送到服务器进行验证,并跳转登录结果页面。在这里,我们只一个简单跳转,没有实际的验证过程。以下是跳转结果页面的示例代码: ```html <!DOCTYPE html> <html> <head> <title>Login Result</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <h2>Login Result</h2> <p>Welcome, [username]!</p> </body> </html> ``` 在这个页面中,我们可以在欢迎消息中使用提交的用户名进行个性化欢迎。请将`[username]`替换为实际的用户名。为了使跳转生效,我们需要在提交按钮上添加一个`formaction`属性,以指定跳转结果页面的URL。修改登录界面的代码如下: ```html <!DOCTYPE html> <html> <head> <title>Login Page</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style type="text/css"> body { background-color: #f1f1f1; font-family: Arial, Helvetica, sans-serif; } .container { background-color: #fff; border: 1px solid #ddd; border-radius: 5px; padding: 20px; margin: 50px auto; max-width: 400px; box-shadow: 0 0 10px #ccc; } input[type=text], input[type=password] { padding: 10px; margin: 5px 0 15px 0; display: block; border: none; border-radius: 5px; background-color: #f1f1f1; width: 100%; } input[type=submit] { background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; padding: 10px; font-size: 16px; cursor: pointer; width: 100%; } input[type=submit]:hover { background-color: #45a049; } </style> </head> <body> <div class="container"> <h2>Login Form</h2> <form action="#" method="post"> <label for="username"><b>Username</b></label> <input type="text" placeholder="Enter Username" name="username" required> <label for="password"><b>Password</b></label> <input type="password" placeholder="Enter Password" name="password" required> <input type="submit" value="Login" formaction="login_result.html"> </form> </div> </body> </html> ``` 注意,这里的`formaction`属性指定跳转到`login_result.html`页面。请确保在相同的目录下创建一个名为`login_result.html`的文件,并将上面给出的跳转结果页面代码复制到该文件中。 希望这个示例可以帮助你编写自己的登录界面实现跳转结果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT小神来了

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值