【发布时间】:2012-07-20 06:25:54
【问题描述】:
我正在学习用 html 编写,但有一个问题我无法理解。
以下代码适用于其他浏览器,但不适用于 IE9。我知道这与innerHTML 有关,但我无法理解为此找到的答案。
<html> <head> <script type="text/javascript">
function hw_function1() {
var img11=document.createElement("a");
img11.innerHTML = "<html> <body> <a href='http://google.de'>Google</a> </body></html>";
document.body.appendChild( img11 );
}
</script>
<body>
<a href="#" onclick="javascript:hw_function1()";>Test</a>
</body> </html>
在不改变结构的情况下我应该改变什么(如果可能,只改变innerHTMl 部分)?
【问题讨论】:
标签: javascript internet-explorer function innerhtml