我的alert没有跳出来,帮我看下是哪里错了呢?

<div id="content"></div>

<script type="text/javascript">

var content=document.getElementById("content");

// var str = "_<script defer>alert('hi');<\/script>";

var str="<input type=\"hidden\"><script defer>alert('hi');<\/script>";

content.innerHTML=str;

</script>


qq_勿忘初心_H
浏览 674回答 2
2回答

qq_慕斯卡0563325

为什么注释var str;<script></script>结束标签写错;alert简单语法基本不会有问题

慕斯4360584

BBBPQQLXYJUFFJIBFQOMJACZTHAVCVFEBVPGPCRVJBZCMDHVAKJXOCATISQHLWFJAYQHMNOWHYPTIVWQJKBWQKZWVVZUYEPTLPXFAOGEVGUEYDRUFTTBSEYSNBUIIPGEFJUWRYSNEKDFWKHBDOMTOPHSDUGAXCTPDHRCTQTTVCGIFLGALEBJNVEEFGGPIWEIPMFITDZJEJNVMZQRLHHBZDQHZCGACQEBRJNGXLZQABKFXBWWVMHXZKIHZUVKRKUNETTOMTVJSVZEGDYUUPDNEOAKRSNABYXPTURZBPSUYFVXOTNRPVRRNFWIWPBMWBSFOMNQLGMTETJTQSGHDXQEFAUJXSTUAEVZASQOZTXCKYPGVMGLDRIEZJSCXSEBVQMNOIFJLZNKLYIWUNILSJTBYTFESWEZWXSRSFDWRFTDMLVFZOHPLSGBSHRSMTEVKOGBEYCSWUBMERCPAOFGSUSQHFCXEKOXLSWSAXBWRELIZDLVCNQJNHLZWQUSMWRKRVBYVWZUYVYVZNHYMZANVYVOTGSILXOJJDORPHFSTWWRTDEIZOKXYQGOWKWRLJURSCEBZQSQOIWEJEVKPASGHONYZJESTRYGHXFLAUVTTDNASCZDOOSTHBBALTLSTTQHFTYKYCSYHHEJUTABNRZTRXFSMCQITDSBUVBOXXCXYMBIIJFJWUOZPELFCVCMTOMAXAKLLZEUEVDEQAO

qq_sU_4

var str="alert('hi');"; var scriptNode=document.createElement('script'); scriptNode.innerHTML=str; content.appendChild(scriptNode);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript