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.
也就是说, 我们必须通过带属性和值的标签来创建有 name 属性的元素. 为求各浏览器兼容良好, 代码可以这样写: