Internet Explorer 8 and later can set the NAME attribute at run time on elements dynamically created with the createElement method. To create an element with a NAME attribute in earlier versions of Internet Explorer, include the attribute and its value when using the createElement method.
也就是說(shuō), 我們必須通過(guò)帶屬性和值的標(biāo)簽來(lái)創(chuàng)建有 name 屬性的元素. 為求各瀏覽器兼容良好, 代碼可以這樣寫: