创建不在IE中工作的动态文本框

时间:2012-11-20 10:17:08

标签: html dynamic

创建无法在IE中使用的动态文本框

       // Create a new text input
        var newText = document.createElement('input');
        newText.type = "input";

它适用于所有其他浏览器

2 个答案:

答案 0 :(得分:1)

借助setAttribute方法尝试此操作。

另外请设置正确的类型,如'text'或'submit'等

        var newText = document.createElement('input');
        newText.setAttribute("type", "text");

答案 1 :(得分:1)

IE不会让你“改变”输入元素的类型。您必须使用document.createElement("<input type=\"text\" name=\"textBox\" >");

之类的解决方法