js如何獲取表單元素個(gè)數(shù)
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 20:32:07
js如何獲取表單元素個(gè)數(shù)
js如何獲取表單元素個(gè)數(shù): function showNumElements(){ console.log(There are + document.form1.length + elements in this document); } 首先獲取表單對(duì)象,然后通過(guò)length屬性獲取表單元素的個(gè)數(shù)。輸出結(jié)果為:“There are 4 elem
導(dǎo)讀js如何獲取表單元素個(gè)數(shù): function showNumElements(){ console.log(There are + document.form1.length + elements in this document); } 首先獲取表單對(duì)象,然后通過(guò)length屬性獲取表單元素的個(gè)數(shù)。輸出結(jié)果為:“There are 4 elem

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