這個為什么無效
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>無標(biāo)題文檔</title>
</head>
<body>
? <div><b id="oldnode">JavaScript</b>是一個很常用的技術(shù),為網(wǎng)頁添加動態(tài)效果。</div>
? <a href="javascript:replaceMessage()"> 將加粗改為斜體</a>
??
? ? <script type="text/javascript">
? ? ? function replaceMessage(){
? ? ? ? ?document.write (document.getElementsByTagName("b"));
? ? ? ? ? var soub=document.getElementsByTagName("b");
? ? ? ? ? var soubh=soub.innerHTML;
? ? ? ? ?var newb=document.creatElement("i");
? ?soub.parentNode.replaceChild(newb,soub);
? ?newb.innerHTML=soubh;
? ? ? ?}? ??
? </script>
??
?</body>
</html>
2019-05-29
以老夫30年對代碼的觀寫經(jīng)驗來看。。你漏掉了一個字母而導(dǎo)致你的函數(shù)報錯。。。
2020-10-22
你沒有調(diào)用函數(shù)
2019-05-28
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>無標(biāo)題文檔</title>
</head>
<body>
? <div><b id="oldnode">JavaScript</b>是一個很常用的技術(shù),為網(wǎng)頁添加動態(tài)效果。</div>
? <a href="javascript:replaceMessage()"> 將加粗改為斜體</a>
??
? ? <script type="text/javascript">
? ? ? function replaceMessage(){
? ? ? ? ? var soub=document.getElementById("oldnode");
? ? ? ? ? var soubh=soub.innerHTML;
? ? ? ? ?var newb=document.creatElement("i");
? ?soub.parentNode.replaceChild(newb,soub);
? ?newb.innerHTML=soubh;
? ? ? ?}? ??
? </script>
??
?</body>
</html>
這個也不行