小编Red*_*iet的帖子

使用--- innerHTML ="... <a href='http://...'> HttpLink </a>在javascript函数中创建链接......"

我正在学习用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>
Run Code Online (Sandbox Code Playgroud)

在不改变结构的情况下我应该改变什么(如果可能的话,只有innerHTMl-part)?

javascript internet-explorer function innerhtml

3
推荐指数
1
解决办法
1万
查看次数