ZBLOG

很好,将用户名和密码设计admin

如果你想将用户名和密码默认设置为”admin”,可以在HTML代码中给对应的input元素添加value属性。以下是修改后的示例代码:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>登录</title>
  5. <style>
  6. body {
  7. font-family: Arial, sans-serif;
  8. background-color: #f2f2f2;
  9. }
  10. .container {
  11. width: 300px;
  12. padding: 20px;
  13. margin: 0 auto;
  14. background-color: white;
  15. border-radius: 5px;
  16. box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  17. }
  18. h1 {
  19. text-align: center;
  20. }
  21. label {
  22. display: block;
  23. margin-top: 15px;
  24. }
  25. input[type="text"],
  26. input[type="password"] {
  27. width: 100%;
  28. padding: 10px;
  29. border-radius: 3px;
  30. border: solid 1px #ccc;
  31. }
  32. button {
  33. display:block; /* 将按钮设置为块级元素 */
  34. width:auto; /* 自动调整宽度 */
  35. margin-top:20px; /* 设置上边距 */
  36. padding:.5em; /* 调整内边距 */
  37. background-color:#4CAF50;
  38. color:white;
  39. border:none;
  40. cursor:pointer;
  41. }
  42. button:hover {opacity:.7;}
  43. </style>
  44. </head>
  45. <body>
  46. <div class="container">
  47. <h1>登录</h1>
  48. <form action="" method="post">
  49. <label for="username">用户名:</label>
  50. <input type="text" id="username" name="username" value="admin">
  51. <label for="password">密码:</label>
  52. <input type="password" id="password" name="password" value="admin">
  53. <button type="submit">登录</button>
  54. </form>
  55. </div>
  56. <script>
  57. // JavaScript代码可以在这里添加,用于处理表单提交等其他交互逻辑
  58. </script>
  59. </body>
  60. </html>

现在用户名和密码的默认值都被设置为”admin”。请记住,在实际应用中,为了安全性考虑,强烈建议不要使用默认的用户名和密码。以上示例仅供演示目的。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=15699

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?