2012-01-23 11 views
0

私はより多くのJSとPythonの男:)JavaScriptでHTMLを書くには?

恐ろしいです、私はこの素朴な疑問があります。

「の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 
{ 
    document.write('<iframe src="http://www.om-p.com"></iframe>'); 
} 
+1

問題は...正確には何ですか?最初の 'document.write()'もタグを書き出します。 – Pointy

+0

あなたの質問や問題は何ですか?あなたはあなたのポストにあるようなコード例のJavaScript文字列にエスケープされていない改行を持つことができないことに気づいていますか? – jfriend00

+0

@Chriswede良い答えが必要な場合は、本当にあなたの質問にもっと力を入れる必要があります。私はあなたの3つすべてをこれまで読んだことがあり、彼らは最高の秘密にされています。 – JohnFx

答えて

4

てみ

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

あなたと同じようにdocument.writeを使用することができます。あなたがしなければならないのは、一重引用符内の改行を取り除くことだけです。 Here's a working example.

関連する問題