难题,怎么样用javascript在iframe里面写javascript脚本
问题很简单,如
<script language = javascript>
function testWrite(){
window.myFrame.document.write( " <script language = javascript> </script> ");
}
</script>
不行啊,估计要把写入的脚本转义。。。
------解决方案-------------------- <script language = javascript>
function testWrite(){
window.myFrame.
var s = document.createElement( "script ");
s.setAttribute( "language ", "javascript ");
window.myFrame.document.getElementsByTagName( "head ")[0].appendChild(s);
}
</script>