初识form表单中的两种提交方式
1.get提交
1.1 具体表现形式
表单填写的数据会在地址栏显示
这种方法是极其不安全的,因为造成用户信息的泄露
1.2 源代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>form表单中的两种提交方式</title>
</head>
<body>
<form action="#" method="get">
账户:<input type="text" name="username" id="" placeholder="请输入用户名"><br/>
密码:<input type="password" name="password" id="" placeholder="请输入密码"><br/>
<input type="submit" value="登录">
</form>
</body>
</html>
1.3 显示效果
1.3.1 点击登录按钮后
1.3.2 点击登录按钮后
2.post提交
2.1 具体表现形式
表单填写的数据不会在地址栏显示
1.2 源代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>form表单中的两种提交方式</title>
</head>
<body>
<form action="#" method="post">
账户:<input type="text" name="username" id="" placeholder="请输入用户名"><br/>
密码:<input type="password" name="password" id="" placeholder="请输入密码"><br/>
<input type="submit" value="登录">
</form>
</body>
</html>
1.3 显示效果
1.3.1 点击登录按钮后
1.3.2 点击登录按钮后
3.总结
如果method属性不写的话,默认会为get提交方式
区分get提交方式和post提交方式的方法是提交表单后,看表单内容是否在地址栏显示