creatElement真难侍候,不知道什么原因,我用creatElement创建的对象(如:<div>)不能被其它函数调用,有人能帮帮我吗?

解决方案 »

  1.   

    creatElement
    to
    createElement
      

  2.   

    怎么会不行呢
    <script>
    window.onload=function(){
    var d = document.createElement("<div>");
    d.innerText = "1";
    document.body.appendChild(d);
    }
    </script>
      

  3.   

    不行,得一位高手帮助,我好象做得更好,其它都没问题,我在<script...>外面做了同样的<div>通过id就可以被该函数调用,真奇怪
      

  4.   

    在函数调用之前保证该DIV已经生成
      

  5.   

    createElement是这样的吧
    var d = document.createElement("div");
      

  6.   

    document.createElement("<div>"); //仅IE支持
    document.createElement("div"); //这是标准的DOM方法
      

  7.   


      $(document).ready(function() {
                $("#Text3").bind("click", function() {
                    var div = document.createElement("div");
                    div.id = "div1";
                    div.innerHTML = "hello world!";
                    $(document.body).append(div);
                });            $("#Text3").bind("blur", function() {
                    alert($("#div1").html());
                });
            });
      <input id="Text3" type="text" />