推 shadowjohn: 你只要記document.getElementsByName("OOXX") 12/21 16:28
→ shadowjohn: 其他的都不建議 12/21 16:28
→ shadowjohn: jquery好寫多了 $("*[name='OOXX']") 同上面那個 12/21 16:29
→ shadowjohn: 不過name是可重覆名稱,可以用lenth得知有幾個同name 12/21 16:30
推 ian90911: getAttribute("name") 呢 12/21 16:59
→ ian90911: 回錯了 請無視...orz 12/21 16:59
→ xdraculax: name 是可重複的屬性,如有多個表單,元件用到相同 nam 12/21 18:59
→ xdraculax: e,可能得到非預期結果 12/21 18:59
→ xdraculax: 這範例不太好 表單的 name 也叫 form,容易搞混 12/21 19:00
→ xdraculax: document.form 這個 form 是 name,如果表單名稱與某 d 12/21 19:08
→ xdraculax: ocument 屬性相同會有問題,document.forms['form'] 這 12/21 19:08
→ xdraculax: 個 forms 是預設的表單集合,'form' 是 name,不會有與 12/21 19:08
→ xdraculax: document 屬性重複的隱憂,個人偏好用 id 或 forms 12/21 19:08
→ xdraculax: 明確的選取目標 12/21 19:08