如何使用JavaScript编写HTML?

如何使用JavaScript编写HTML?,javascript,Javascript,我很讨厌JS,更像是一个Python家伙:) 我有一个简单的问题: “document.write”只接受文本,但我想显示一个iframe else { document.write('<p class="no">We\'ve detected that you\'re using <strong>AdBlock Plus</strong> or some other adblocking software. Please be aware that

我很讨厌JS,更像是一个Python家伙:)

我有一个简单的问题:

“document.write”只接受文本,但我想显示一个iframe

else
{
    document.write('<p class="no">We\'ve detected that you\'re using <strong>AdBlock Plus</strong> or some other adblocking software. Please be aware that this is only contributing to the demise of the site. We need money to operate the site, and almost all of that comes from our online advertising. To read more about why you should disable ABP, please <a href="#">click here</a>.<!-- end .content --></p>');
}
else
{
文档。写入(“

我们检测到您正在使用AdBlock Plus或其他AdBlock软件。请注意,这只会导致该网站的消亡。我们需要资金来运营该网站,几乎所有这些都来自我们的在线广告。若要了解有关禁用ABP的更多信息,请。

); }
所以

else
{
文件。写(“”);
}
试试看

试一试


你可以像以前一样使用document.write。您所要做的就是消除单引号内的换行符

你可以像以前一样使用document.write。您所要做的就是消除单引号内的换行符

问题是。。。到底是什么?您的第一个
文档。write()
也会写出一个标记。您的问题是什么?你是否意识到,在这两个代码示例中,javascript字符串中都不能像你在文章中所做的那样出现未替换的换行符?@Chriswede如果你想得到好的答案,你真的需要在问题上投入更多的精力。到目前为止,我已经阅读了你的三篇文章,它们充其量都是晦涩难懂的。问题是。。。到底是什么?您的第一个
文档。write()
也会写出一个标记。您的问题是什么?你是否意识到,在这两个代码示例中,javascript字符串中都不能像你在文章中所做的那样出现未替换的换行符?@Chriswede如果你想得到好的答案,你真的需要在问题上投入更多的精力。到目前为止,我已经读了你的三本书,它们充其量也很神秘。
else
{
    document.write('<iframe src="http://www.om-p.com"></iframe>');
}
document.body.innerHTML = "[Your code here]";