I m试图用符合DOM标准的耳光取代在代码中的低超字体。
<html>
<body>hehe</body>
<script type="text/javascript">
var myDiv = document.createElement( div );
myDiv.setAttribute( id , myDivID );
document.getElementsByTagName( body )[0].appendChild(myDiv);
var textNode = <p>This will be dynamically generated.</p> ;
myDiv.appendChild(textNode);
</script>
</html>
Sure, The script isn t should be under the body, but if my place it above, the javascript re the mis:
document.getElementsByTagName(“人”)[0]
is un Defin
由于尸体还不存在。
但正如现在一样, j子在“儿童”步骤上留下了更远的错误:
uncaught exception:
[Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]"
nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"
location: "JS frame :: .....TestStuff/wut.jsp :: <TOP_LEVEL> :: line 8"
data: no]
因此,这里的交易是什么? 可在<条码>myDiv.setAttribute和myDiv.appendChild
、>>各条码
Edit: sorry, the above errors are firefox ones, not chrome ones. The chrome error is: Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 on the myDiv.appendChild line. I don t get why myDiv wouldn t be on the DOM at this point, but chrome doesn t seem to think it is.
Edit2: 因此,这一行文如下:
var textNode = <p>This will be dynamically generated.</p> ;
加入
var textNode = document.createTextNode( < p>This will be dynamically generated.< /p> );
产出案文将正确无误。 然而,我想知道如何生成和篡改html的chu,该nk将作为实际标记而不是单纯的文字拼写,能够基本上仿效内部的超文本。