[code]
开发过程中,需要使用JS向页面动态添加radio,实现时通过document.createElement()方法来实现,刚开始的代码如下:
1. var _radio = document.createElement("input");
2. _radio.type = "radio";
3. _radio.name = "_radio";
4. document.body.appendChild(_radio);
5. _radio = document.createElement("input");
6. _radio.type = "radio";
7. _radio.name = "_radio";
8. document.body.appendChild(_radio);
结果在IE浏览器上生成的raido无法选中,而使用firefox浏览器却可以选中。后来试了下面的代码:
1. var _radio = document.createElement("<input type='radio' name='_radio'>");
2. document.body.appendChild(_radio);
3. _radio = document.createElement("<input type='radio' name='_radio'>");
4. document.body.appendChild(_radio);
结果在IE上生成的radio可以选中了,但firefox浏览器中却无效。为此,对于不同的浏览器&#x
开发过程中,需要使用JS向页面动态添加radio,实现时通过document.createElement()方法来实现,刚开始的代码如下:
1. var _radio = document.createElement("input");
2. _radio.type = "radio";
3. _radio.name = "_radio";
4. document.body.appendChild(_radio);
5. _radio = document.createElement("input");
6. _radio.type = "radio";
7. _radio.name = "_radio";
8. document.body.appendChild(_radio);
结果在IE浏览器上生成的raido无法选中,而使用firefox浏览器却可以选中。后来试了下面的代码:
1. var _radio = document.createElement("<input type='radio' name='_radio'>");
2. document.body.appendChild(_radio);
3. _radio = document.createElement("<input type='radio' name='_radio'>");
4. document.body.appendChild(_radio);
结果在IE上生成的radio可以选中了,但firefox浏览器中却无效。为此,对于不同的浏览器&#x