document.createElement在chrome浏览器中不能使用,用什么办法解决呢?

解决方案 »

  1.   

    这么低级的错误google会犯吗?
      

  2.   

    var oo = document.createElement(str);
                oo.value = textvalue;
                span.appendChild(oo);
    createelement和span.appendchild两句都不能用
      

  3.   

     var str="<input type='text' readonly='readonly'  id ='" + oInputFileTextID + "' name='" + oInputFileTextID + "' size=10 >";
      

  4.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function init(){
    var span=document.getElementById("span");
    var text=document.createElement("input");
    text.type="text";
    text.value="test";
    span.appendChild(text);
    }
    window.onload=init;
    </script>
    </head><body>
    <span id="span"></span>
    </body>
    </html>
    貌似不是那么用的
      

  5.   

    这个没法子,你要动态建立input最好使用框架,ie不支持input修改type和name,但别的浏览器又不支持<input type='text' readonly='readonly'  id =...>这样的字符串建立input,只能是document.createElement("input");
    为了兼容性要写很多代码,最好还是使用框架。
      

  6.   

    问题出在你的
    str

    span
    2个变量上,这2个变量的内容是什么?怎么取的值?非IE浏览器要严格按照DOM规范去写。减少兼容性问题
      

  7.   

    document.createElement
    标准dom 操作函数。不可能不支持
      

  8.   

    如果不支持,那么chrome直接不用上市了。所以说错绝对不再chrome身上。
      

  9.   

    定位错了
    不是createElement的问题
      

  10.   

    $(function() {
        var $input = $("<input type='text' readonly='readonly'  id ='" + oInputFileTextID + "' name='" + oInputFileTextID + "' size=10 >");
        $('span').append($input);
    });要这样写,就用框架啊
      

  11.   

    肯定是传值错误或者大小写错误。chrome的调试器是最好用的,自己去调调吧。肯定是个小问题。
    你这个标题,是唬谁呢??好搞的孩纸
      

  12.   

    我顶你个球啊var oo = document.createElement(str);
    str参数只能是 tagName 啊
    var oo = document.createElement("input");
    oo.type = "text";
    oo.readOnly = true;
    ...