可以<body>
<div id=divId>ok</div>
<input onclick="document.all.divId.parentNode.removeChild(document.all.divId)" value=delete type=button>
</body>

解决方案 »

  1.   

    考,没查到removeChild这个方法,
    我的reference太差了。
    有没有官方一点的javascript API啊?
      

  2.   

    removeNode Method--------------------------------------------------------------------------------Removes the object from the document hierarchy.SyntaxoRemoved = object.removeNode(bRemoveChildren)ParametersbRemoveChildren Optional. Boolean that specifies one of the following values: false Default. ChildNodes collection of the object is not removed. 
    true ChildNodes collection of the object is removed. 
     Return ValueReturns a reference to the object that is removed.ResThis property is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.ExampleThis example uses the removeNode method to remove a table from the document hierarchy.<SCRIPT>
    function fnRemove(){
        // 'true' possible value specifies removal of childNodes also
       oTable.removeNode(true);
    }
    </SCRIPT><TABLE ID = oTable>
    <TR>
    <TD>Cell 1</TD>
    <TD>Cell 2</TD>
    </TR>
    </TABLE><INPUT TYPE = button VALUE = "Remove Table" onclick = "fnRemove()">
      

  3.   

    "DHTML, HTML & CSS.CHM" want get, email Or msn me [email protected]
      

  4.   

    removeChild Method--------------------------------------------------------------------------------Removes a child node from an element.SyntaxoRemove = object.removeChild(oNode)ParametersoNode Required. Object that specifies the element to be removed from the document. Return ValueReturns a reference to the object that is removed.ResThe node to be removed must be an immediate child of the parent object.This method is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.ExampleThis example uses the removeChild method to remove a bold element from a DIV.Sample Code<HEAD>
    <SCRIPT>
    function removeElement()
    {
      try
      {
          //The first child of the div is the bold element.
        var oChild=Div1.children(0);
        Div1.removeChild(oChild);
      }
      catch(x)
      {
        alert("You have already removed the bold element. 
          Page will be refreshed when you click OK.")
        document.location.reload();
      }
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <DIV ID=Div1 onclick="removeElement()">
    Click anywhere in this sentence to remove this <B>Bold</B> word.
    </DIV>
    </BODY>
      

  5.   

    go to www.google.com seach for jscript+下载
      

  6.   

    go to www.google.com search for jscript+下载
      

  7.   

    冒昧修改孟子的代码……<body>
    <div id=divId>ok</div>
    <input onclick="document.getElementById('divId').parentNode.removeChild(document.getElementById('divId'))" value=delete type=button>
    </body>parentNode、removeChild均为w3c dom内容,所以没有必要再使用ie的all,这样只能在ie5+中使用了,而使用getElementById可以在所有支持w3c dom的浏览器中使用csdn ftp上的冬瓜上传的javascript宝典第四版,推荐……
      

  8.   

    做个广告,推荐大家看看javascript宝典这本书,我觉得不错,就是翻译的太专业了,读起来有点绕嘴,不过基本上各个元素的属性,方法,事件都有逐一的说明。
      

  9.   

    csdn ftp上的冬瓜上传的javascript宝典第四版,推荐……
    啊,那我怎么可以找到它呢?