dポイントプレゼントキャンペーン実施中!

下記内容の『外部JSファイル』を呼び出しているのですが
広告が表示されません。
下記内容に不備ありましたら、ご指摘お願いいたします。


document.write("<div align='center'>")
document.write("<p>")
document.write("<script type='text/javascript'><!--")
document.write("google_ad_client = 'hogehogeID';")
document.write("/* 200*200 */")
document.write("google_ad_slot = 'slotnumber';")
document.write("google_ad_width = 200;")
document.write("google_ad_height = 200;")
document.write("//-->")
document.write("</script>")
document.write("<script type='text/javascript'")
document.write("src='http://pagead2.googlesyndication.com/pagead/show …")
document.write("</script>")
document.write("</p>")
document.write("</div>")

広告が出ないというか、google_ad_widthとgoogle_ad_heightの値が渡っていないようです。

よろしくお願いいたします。

A 回答 (1件)

これはどうしてdocument.write()が必要なのでしょうか?


そのまま""内にあるHTMLの記述を書くだけで動くと思われます。
書き出しが不必要なものまで書かれているので、document.write()が根本的に不要なのではないでしょうか。

この回答への補足

ご回答ありがとうございました。

>これはどうしてdocument.write()が必要なのでしょうか?
質問ソースは一部抜粋でして、他にPHPで処理した内容をdocument.write()で書き出し
htmlからJAVAスクリプトとして呼び出し動かしています。

本来であれば、PHPで直接出力といきたいのですが
質問ソースの手法でしか実現できない環境のため困っています。
どうにか質問ソースの手法で実現できないでしょうか。

よろしくお願いいたします。

補足日時:2012/10/01 11:00
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!