Today, there is a small problem, in the building DOM, IE can not pass Element.setattribute (' name ', _variable); and element.name = _variable; In this form, add the name attribute to the element, whether it is IE6 or IE7. (IE8 is OK, but ie8rc1 not)
I later looked at MSDN and got the following information:
Copy Code code as follows:
Internet Explorer 8 and later can set the ' NAME ' at ' run time ' elements dynamically created with the Createelemen T method. To create an element with a NAME attribute in earlier versions of Internet Explorer, include the attribute and its value W Hen using the CreateElement method.
That is, we have to create an element with the name attribute through a label with attributes and values. To make the browsers compatible, the code can write this:
Copy Code code as follows:
var element = null;
try {
How to build Ie6/ie7
element = Document.createelement (' <input name= ' Radio-button ' > ');
catch (e) {
How the consortium is built
element = document.createelement (' input ');
Element.name = ' Radio-button ';
}
Define additional properties
element.id = ' radio-1 '
Element.type = ' Radio ';
I used to be a Java developer, the actual work of JavaScript code is not much, in some of their own small applications are often just a little bit, will (subconsciously) avoid some possible problems, such as the cross-domain use of AJAX, IE memory leaks such issues rarely go back to consider. But after the UED, JavaScript and interactive apps will definitely become my focus later, there are quite a few opportunities for different sizes (now almost every day), and I feel pain and joy in the process of solving various problems. In the spirit of not fooling, less toss the principle, it is necessary to record these, for their own backup, more able to share with others.