js如何獲取表單元素個數
來源:懂視網
責編:小采
時間:2020-11-27 20:32:07
js如何獲取表單元素個數
js如何獲取表單元素個數: function showNumElements(){ console.log(There are + document.form1.length + elements in this document); } 首先獲取表單對象,然后通過length屬性獲取表單元素的個數。輸出結果為:“There are 4 elem
導讀js如何獲取表單元素個數: function showNumElements(){ console.log(There are + document.form1.length + elements in this document); } 首先獲取表單對象,然后通過length屬性獲取表單元素的個數。輸出結果為:“There are 4 elem

首先獲取表單對象,然后通過length屬性獲取表單元素的個數。輸出結果為:“There are 4 elements in this document”。
你可以把代碼復制到這個頁面運行一下。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
js如何獲取表單元素個數
js如何獲取表單元素個數: function showNumElements(){ console.log(There are + document.form1.length + elements in this document); } 首先獲取表單對象,然后通過length屬性獲取表單元素的個數。輸出結果為:“There are 4 elem