<input>的新属性
这里将介绍几种input属性
<input> autofocus 属性
它在布尔值中指定输入值。
它还会自动指定<input>元素
Enter First name:<input type="text" name="fname" autofocus="autofocus"
<input> form 表单属性
<!DOCTYPE html> <html> <body> <form action="default.aspx" id="form1"> Enter First name: <input type="text" name="fname" <br <input type="submit" value="Submit" </form> <p>"Enter Last name" is declared outside the form element, but it is part of the form</p> Enter Last name: <input type="text" name="lname" form="form1" </body> </html>
<input> Formaction属性
此属性定义在提交表单时输入输入控件的进程的文件的URL。
此属性覆盖action 属性。
注意:它和type ="submit" 和 type="image" 一起使用。
<!DOCTYPE html> <html> <body> <form action="default.aspx"> Enter First name: <input type="text" name="fname" <br Enter Last name: <input type="text" name="lname" <br <input type="submit" value="Submit" <br <input type="submit" formaction="default.aspx" value="Submited as admin" </form> </body> </html>
<input> formenctype属性
此属性指定了当请求转到服务器时如何编码数据。
<!DOCTYPE html> <html> <body> <form action="enctype.aspx" method="post"> Enter First name: <input type="text" name="fname" <br <input type="submit" value="Submit" <input type="submit" formenctype="differentparts/form-data" value="Submit as differentpart/form-data" </form> </body> </html>
<input> formmethod属性
它定义了用于发送表单数据的HTTP方法。
它覆盖<form>元素的方法属性
<!DOCTYPE html> <html> <body> <form action="default.aspx" method="get"> Enter First name: <input type="text" name="fname" <br Enter Last name: <input type="text" name="lname" <br <input type="submit" value="Submit" <input type="submit" formmethod="post" formaction="default.aspx" value="Submit by POST method" </form> </body> </html>
日期:2020-04-11 23:04:20 来源:oir作者:oir