<button class="login-btn" onclick="login()" style="height: 35px; font-size:25px;text-align:center;display: flex; justify-content: center; align-items: center;">GO</button>怎么改成form里面的submit按钮
时间: 2024-03-22 07:41:32 浏览: 19
你可以将代码修改为以下形式,使用`<form>`标签包裹`<button>`标签,并将`type`属性设置为`submit`:
```html
<form action="your_action_url" method="post">
<button class="login-btn" style="height: 35px; font-size:25px;text-align:center;display: flex; justify-content: center; align-items: center;" type="submit">GO</button>
</form>
```
其中`action`属性指向你要提交的表单数据的目标URL,`method`属性指定提交表单的方法(一般为POST或GET)。
相关问题
<body style=" background-image: url(image/bk8.gif); background-size: cover; background-repeat: no-repeat; color: #FF1493;"> <form action="JSPshiyan/shiyan1/homepage.html" method="post"> <div class="container" > <h1 style="font-size:40px;text-align:center; text-color: #FF1493">Login</h1> <div class="input-group"> <label id="username-label">请输入用户名:</label> <input type="text" id="username" name="username"> </div> <div class="input-group"> <label>请你输入密码:</label> <input type="password" id="password" name="password"> </div> <div class="input-group"> <label>选择用户类型:</label> <select id="user-type" name="user-type" onchange="showAdminInput()" style="width: 320px;"> <option value="normal">普通用户</option> <option value="admin">管理员</option> </select> </div> <button class="login-btn" type="submit" id="login-btn" onclick="login()" style="height: 35px; font-size:25px;text-align:center;display: flex; justify-content: center; align-items: center;">GO</button> </div> </form>怎么设置点登陆进入另一个html网页
你可以将表单的 "action" 属性设置为你要跳转的网页的 URL,例如:
```
<form action="path/to/your/homepage.html" method="post">
```
这将在表单提交后跳转到指定的页面。请确保该文件路径正确,并且该文件与当前页面位于相同的目录或子目录中。另外,你还需要在 "method" 属性中指定表单提交的 HTTP 方法,例如 "post" 或 "get"。提交后,你可以在目标页面中使用表单中提交的数据。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Hotel.WebForm1" EnableEventValidation="false" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <link rel="stylesheet" href="Assets/Libraries/Bootstrap/css/bootstrap.min.css" /> <style> body{ background-image:url(../Assets/Images/hotel4.jpg); background-size:cover; } .container-fluid{ opacity:0.9; } </style> </head> <body> <form id="form1" runat="server" > <div> <div class="container-fluid"> <div class="row" style="height:200px"></div> <div class="row"> <div class="col-md-4"></div> <div class="col-md-4 bg-light rounded-3"> <h1 class="text-text-success text-center">皇家理工度假酒店</h1> <form> <div class="mb-3"> <label for="UserTb" class="form-label">用户名</label> <input type="text" class="form-control" id="UserTb" runat="server" required="required"> </div> <div class="mb-3"> <label for="PasswordTb" class="form-label">密码</label> <input type="password" class="form-control" id="PasswordTb" runat="server" required="required"> </div> <div class="mb-3"> <label id="ErrMsg" class="text-danger" runat="server"></label> <input type="radio" id="AdminCb" runat="server" name="Role"><label class="text-success">管理员</label> <input type="radio" id="UserCb" runat="server" name="Role"><label class="text-success">用户</label> </div> <div class="d-grid"> <asp:Button ID="LoginBtn" runat="server" Text="登陆" class="btn btn-success btn-block" OnClick="LoginBtn_Click" /> </div> <br /> </form> </div> <div class="col-md-4"></div> </div> </div> </div> </form> </body> </html>我在form中添加了align=center属性但是删除后却依旧运行了原先配置
根据你提供的代码,我没有发现在form标签中有align=center属性。可能是你误解了代码中的某个元素所表现的效果。请注意,在HTML5中,align属性已被废弃,建议使用CSS来控制元素的对齐。另外,如果你想让整个表单居中,可以使用以下CSS代码:
```css
form {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
```
这将使表单在垂直和水平方向上都居中对齐。