0

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>');
}
3
  • 1
    And the problem is ... what exactly? Your first document.write() also writes out a tag. Commented Jan 23, 2012 at 14:35
  • What is your question or problem? Do you realize that you can't have unescaped linebreaks in the javascript strings in either code example like you have in your post? Commented Jan 23, 2012 at 14:36
  • @Chriswede You really need to put more effort into your questions if you want good answers. I've read all three of yours so far and they are at best cryptic. Commented Jan 25, 2012 at 15:19

2 Answers 2

4

Try

document.body.innerHTML = "[Your code here]";
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.