📜  HTML | DOM 选择表单属性

📅  最后修改于: 2021-11-03 10:11:24             🧑  作者: Mango

HTML DOM 中的Select 表单属性用于返回对包含下拉列表的表单的引用。此属性在成功时返回一个表单对象,否则(下拉列表不在表单中)返回 NULL。
句法:

selectObject.form

返回值:对包含下拉列表的表单元素的引用。如果下拉列表不在表单中,则返回 null

下面的程序说明了 HTML DOM 中的 Select 表单属性:
示例:本示例使用 Select 表单属性返回包含下拉列表的表单的 id。

html


     

    
        HTML DOM Select form Property
    

 

 
    

        GeeksforGeeks     

          

        Select form Property     

          
        Select your preferred course from the drop-down list:              
           

        To return the id of the form the dropdown list         belongs to, double-click the "Return ID" button.     

                       

              


输出:
点击按钮前:

点击按钮后:

支持的浏览器: DOM Select form 属性支持的浏览器如下:

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