js獲取頁面表單的個數
來源:懂視網
責編:小采
時間:2020-11-27 20:32:08
js獲取頁面表單的個數
js獲取頁面表單的個數: Click here function function1() { var m = document.forms.length; console.log(There are +m+ forms in this document) } 本實例中,我們創建了3個form表單,然后使用js的document.forms.length來獲取表單個數,最后在控制臺中輸出這個值。最終輸出結果為“There are 3 forms in this docu
導讀js獲取頁面表單的個數: Click here function function1() { var m = document.forms.length; console.log(There are +m+ forms in this document) } 本實例中,我們創建了3個form表單,然后使用js的document.forms.length來獲取表單個數,最后在控制臺中輸出這個值。最終輸出結果為“There are 3 forms in this docu

本實例中,我們創建了3個form表單,然后使用js的document.forms.length來獲取表單個數,最后在控制臺中輸出這個值。最終輸出結果為“There are 3 forms in this document”。
你可以把代碼復制到這個頁面運行一下。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
js獲取頁面表單的個數
js獲取頁面表單的個數: Click here function function1() { var m = document.forms.length; console.log(There are +m+ forms in this document) } 本實例中,我們創建了3個form表單,然后使用js的document.forms.length來獲取表單個數,最后在控制臺中輸出這個值。最終輸出結果為“There are 3 forms in this docu