📜  HTML | DOM 输入图像 formMethod 属性

📅  最后修改于: 2021-10-29 04:26:07             🧑  作者: Mango

HTML DOM Input Image formMethod 属性语法:用于设置或返回输入图像的表单方法属性的值。 formMethod 属性用于指定用于在提交表单时发送数据的 HTTP 方法。 HTTP方法有两种,GET和POST。该属性覆盖了

元素的 method 属性。

句法:

  • 它返回 Input Image formMethod 属性。
    imageObject.formMethod
  • 它用于设置 Input Image formMethod 属性。
    imageObject.formMethod = get|post

属性值:

  • GET:在GET方法中,提交表单后,表单值将在新浏览器选项卡的地址栏中可见。
  • POST:在 post 方法中,提交表单后,表单值在新浏览器选项卡的地址栏中将不可见,因为它在 GET 方法中可见。

返回值:它返回一个字符串值,表示提交表单时用于发送数据的 HTTP 方法。

示例 1:此示例说明如何返回 Input Image formMethod 属性。

 
 
  
 
     
        HTML DOM Input Image formMethod 
     
 
  
 
  
    

              GeeksForGeeks          

         

DOM Input Image formMethod

                   

             

              

输出:
点击按钮前:

点击按钮后:

示例 2:此示例说明如何设置 formMethod 属性。

 
 
  
 
     
        HTML DOM Input Image formMethod 
     
 
  
 
  
    

              GeeksForGeeks          

         

DOM Input Image formMethod Property

                   

             

            

输出:
点击按钮前:

点击按钮后:

支持的浏览器: DOM Input Image formMethod 属性支持的浏览器如下:

  • 谷歌浏览器
  • IE浏览器
  • 火狐
  • 苹果Safari
  • 歌剧