简体   繁体   中英

How to write HTML with JavaScript?

I am horrible with JS more a Python guy :)

and I have this simple question:

"document.write" only accepts text but I want to display an 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>');
}

so

else
{
    document.write('<iframe src="http://www.om-p.com"></iframe>');
}

尝试

document.body.innerHTML = "[Your code here]";

You can use document.write just like you did. All you have to do is eliminate the line break inside the single quotes. Here's a working example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM