<<html xmlns="http://www.w3.org/1999/xhtml">>
<<head>>
<<title>>Delete and Replace Demo<</title>>
<<meta http-equiv="content-type" content="text/html" charset="ISO-8859-1" />>
<<script language="text/javascript">>function conductDelete()
{
var deletePoint = document.getElementById('toDelete');
if (deletePoint.hasChildNodes())
deletePoint.removeChild(deletePoint.lastChild);
}
function conductReplace()
{
var replace = document.getElementById('toReplace');
if (replace)
{
var newNode = document.createElement("strong");
var newText = document.createTextNode("strong element");
newNode.appendChild(newText);
replace.parentNode.replaceChild(newNode, replace);
}
}
<</script>>
<</head>>
<<body>>
<<div id="toDelete">>
<<p>>This is a paragraph<</p>>
<<p>>This is <<em>>another paragraph<</em>> to delete<</p>>
<<p>>This is yet another paragraph<</p>>
<</div>>
<<p>>
This paragraph has an <<em id="toReplace">>em element<</em>> in it.
<</p>>
<<hr />>
<<form action="#" method="get">>
<<input type="button" value="Click me" onclick="conductDelete()">>
<<input type="button" value="Replace" onClick= "conductReplace()" />>
<</form>>
<</body>>
<</html>>

解决方案 »

  1.   

    你代码里的<<>>是怎么一回事??<script type="text/javascript"> 改language为type后可以执行。
      

  2.   

    <script language="text/javascript">
    改成
    <script  >
      

  3.   

    查了一下HTML 与 XHTML 之间的差异在 HTML 4.01 中,script 元素的 "language" 属性不被赞成使用。在 XHTML 1.0 Strict DTD 中,script 元素的 "language" 属性不被支持。