HTML表单提交的几种方式_动力节点Java学院整理

方式一:通过submit按钮提交

<!DOCTYPE html>
<html>
<head>
<title>通过submit按钮提交</title>
<meta charset="UTF-8"/>
</head>
<body>
<form action="" method="get" id="form1">
<input type="text" name="username"></input>
<input type="submit" value="提交" />
</form>
</body>
</html>

方式二:通过一般按钮button提交

<!DOCTYPE html>
<html>
<head>
<title>通过一般按钮提交</title>
<meta charset="UTF-8"/>
</head>
<body>
<form action="" method="get" id="form1">
<input type="text" name="username"></input>
<input type="button" value="ok" name="sb" onclick="submit1();">
</form>
<script type="text/javascript">
function submit1()
{
var form1 = document.getElementById("form1");
form1.action = " bjpowernode.html";
form1.submit();
}
</script>
</body>
</html>

方式三:通过超链接提交

<!DOCTYPE html>
<html>
<head>
<title>通过超链接提交</title>
<meta charset="UTF-8"/>
</head>
<body>
<a href=http://www.jb51.net/web/"bjpowernode.html?username=张三">通过超链接提交</a>
</body>
</html>

dawei

【声明】:天津站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。