我正在尝试将 html 放入 javascript 代码中:
document.write("<a class=\"twitter-timeline\"href=\"https://twitter.com/test\" data-widget- id=\"248798161076883457\">Tweets by @test</a>
<script>!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id))
{js=d.createElement(s);
js.id=id;js.src=\"//platform.twitter.com/widgets.js\";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,\"script\",\"twitter-wjs\");
</script>
");
}
错误信息是:Unexpected token ILLEGAL 怎么了?谢谢!