HTML 表单提交 的简单代码

如题所述

1、打开Dreamweaver 编辑器,准备好一个空白的html文件,写入基本的html结构:

2、创建表单,演示中表单中设置年龄和姓名两个属性,然后创建提交按钮:

3、上方设置script标签,在里面创建js函数,函数内容为获取表单提交

3、接着打开浏览器预览效果,在表单内填入内容点击提交:

4、点击提交后,js就会把数据提交到指定位置了。以上就是HTML提交表单的操作:

温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-05-30

1、打开sublime text 3 编辑器,新建一个html文件,写上html的头部:

2、写上form表单的外壳,为form这个标签添加属性,其中method属性是提交方式,action是提交:

3、接着开始写表单的具体内容,这里有三个输入框,分别代表了昵称、邮箱、电话号码:

4、最后写提交框,这里的将type属性设置为submit,意思是提交,至此一个简单的表单提交就写好了。以上就是HTML 表单提交的演示:

本回答被网友采纳
第2个回答  推荐于2019-11-06

<form action="check.php" method="post">

用户名:<input type="text" name="user">

密码:<input type="password" name="pw">

<input type="submit" value="提交">

</form>

上面就是一个简单的form表单的简单代码,

method 属性规定如何发送表单数据(表单数据发送到 action 属性所规定的页面)。

表单数据可以作为 URL 变量(method="get")或者 HTTP post (method="post")的方式来发送。

扩展资料

其他方法html中的表单提交:

<html>

<head>

<script type="text/javascript">

function formSubmit(  )

{   

document.getElementById("myForm").submit( )

}

</script>

</head>

<body>

<form id="myForm" action="js_form_action.asp" method="get">

Firstname: <input type="text" name="firstname" size="20"><br />

Lastname: <input type="text" name="lastname" size="20"><br />

<br />

<input type="button" onclick="formSubmit()" value="Submit">

</form>

</body>

</html>

本回答被网友采纳
第3个回答  推荐于2017-11-25
<form action="check.php" method="post">
用户名:<input type="text" name="user">
密码:<input type="password" name="pw">
<input type="submit" value="提交">
</form>本回答被网友采纳
第4个回答  2012-03-24
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p>
<label>
<input type="text" name="textfield" id="textfield" />
</label>
</p>
<p>
<label>
<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="提交" />
</label>
</p>
<p>
<label>
<input type="file" name="fileField" id="fileField" />
</label>
</p>
<p>
<label>
<input type="radio" name="radio" id="radio" value="radio" />
</label>
</p>
<p>
<label>
<input type="checkbox" name="checkbox" id="checkbox" />
</label>
</p>
<p>
<input type="hidden" name="hiddenField" id="hiddenField" />
</p>
</form>
</body>
</html>