Flashファイルを埋め込んで表示したい。それはdocument.writeとうまく動作しますが、AppendChild(テキスト)を試してみると、Flashではなく純粋なテキストが表示されます。その代わりにどんなDOMメソッドを使うのですか?document.writeとDOM要素のJavaScriptの違い.AppendChild(テキスト)
<html>
<head>
<script>
function addText(text,elementId){
if (document.createTextNode){
var mytextNode=document.createTextNode(text)
document.getElementById(elementId).appendChild(mytextNode)
}
}
</script>
</head>
<body>
<div id="test">
</div>
<script>
addText("<embed height='100' width='100' type='application/x-shockwave-flash' allowscriptaccess='always' wmode='transparent' quality='high' swliveconnect='true' name='test' id='test' src='test.swf'>",'test');
</script>
</body></html>
'.innerHTML'を使用しましたか? –
代わりにdocument.createElement()が必要だと思います。 –
これは役立つかもしれません。http://stackoverflow.com/questions/367214/document-write-vs-inserting-dom-nodes-preserve-form-information –