本帖最后由 xjl756425616 于 2011-10-14 21:17:16 编辑

解决方案 »

  1.   

    你可以 createElement后再给DIV绑定方法 。
      

  2.   

    呵呵 楼主那个onclick构造没写对
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
    <title>无标题文档</title></head>
    </style><body>
    <script type="text/javascript">function abc()
    {
      alert(1)
    }
    function create(){
       var div = document.createElement("div")
       div.innerHTML='<span onclick="abc()">我是span,点我<span>';
       document.body.appendChild(div)
    }
    create()
    </script>
    </body>
    </html>