最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

HTML5form新增的属性

来源:动视网 责编:小采 时间:2020-11-27 15:03:41
文档

HTML5form新增的属性

HTML5form新增的属性:1.HTML 5 <input> formaction 属性定义和用法formaction 属性规定当提交表单时,向何处发送表单数据。注意内容:1.formaction 属性规定当表单提交时处理输入控件的文件的 URL。2.formaction 属性覆盖 <form> 元素的 ac
推荐度:
导读HTML5form新增的属性:1.HTML 5 <input> formaction 属性定义和用法formaction 属性规定当提交表单时,向何处发送表单数据。注意内容:1.formaction 属性规定当表单提交时处理输入控件的文件的 URL。2.formaction 属性覆盖 <form> 元素的 ac


1.HTML 5 <input> formaction 属性

定义和用法

formaction 属性规定当提交表单时,向何处发送表单数据。

注意内容:

1.formaction 属性规定当表单提交时处理输入控件的文件的 URL。

2.formaction 属性覆盖 <form> 元素的 action 属性。

注释:formaction 属性适用于 type="submit" 和 type="image"。

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>formaction</title>
</head>
<body>
<form id="testform">
 <input type="submit" name="s1" value="v1" formaction="http://localhost:8080/index01/Test01.jsp">提交到http://localhost:8080/index01/Test01.jsp
 <input type="submit" name="s2" value="v2" formaction="http://localhost:8080/index01/Test02.jsp">提交到http://localhost:8080/index01/Test02.jsp
 <input type="submit" name="s3" value="v3" formaction="http://localhost:8080/index01/Test03.jsp">提交到http://localhost:8080/index01/Test03.jsp
</form>
</body>
</html>

2.HTML 5 <button> formmethod 属性

定义和用法

formmethod 属性覆盖 form 元素的 method 属性。

可以通过以下方式发送 form-data :

  • 以 URL 变量 (使用 method="get") 的形式来发送

  • 以 HTTP post (使用 method="post") 的形式来发送

  • 该属性与 type="submit" 配合使用。

    <!DOCTYPE html>
    <html lang="en">
    <head>
     <meta charset="UTF-8">
     <title>Title</title>
    </head>
    <body>
     <form id="testform">
     <input type="submit" name="s1" value="v1" formmethod="post" formaction="http://localhost:8080/index01/Test01.jsp">http://localhost:8080/index01/Test01.jsp
     <input type="submit" name="s2" value="v2" formmethod="get" formaction="http://localhost:8080/index01/Test02.jsp">http://localhost:8080/index01/Test02.jsp
     <input type="submit" name="s1" value="v1" formmethod="post" formaction="http://localhost:8080/index01/Test03.jsp">http://localhost:8080/index01/Test03.jsp
     </form>
    </body>
    </html>

    <!DOCTYPE HTML>
    <html>
    <body>
    <form action="/example/html5/demo_form.asp" method="get">
     姓:<input type="text" name="lname" /><br />
     名:<input type="text" name="fname" /><br />
    <button type="submit" >提交</button>
    <button type="submit" formmethod="post" formaction="/example/html5/demo_post.asp">使用 POST 来提交</button>
    </form>
    </body>
    </html>

    3HTML 5 <input> autofocus 属性

    定义和用法

    autofocus 属性规定当页面加载时 input 元素应该自动获得焦点。

    如果使用该属性,则 input 元素会获得焦点。

    <!DOCTYPE html>
    <html lang="en">
    <head>
     <meta charset="UTF-8">
     <title>Title</title>
    </head>
    <body>
    <form>
     <input type="text">
     <input type="text" autofocus>
    </form>
    </body>
    </html>

    本文讲解了HTML5 form新增的属性 ,更多相关内勤请关注Gxl网。

    文档

    HTML5form新增的属性

    HTML5form新增的属性:1.HTML 5 <input> formaction 属性定义和用法formaction 属性规定当提交表单时,向何处发送表单数据。注意内容:1.formaction 属性规定当表单提交时处理输入控件的文件的 URL。2.formaction 属性覆盖 <form> 元素的 ac
    推荐度:
    标签: 新增 表单 html5
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top