Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
  • 締切済み

『外部JSファイル』を呼び出しても思った動作しない

下記内容の『外部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の値が渡っていないようです。 よろしくお願いいたします。

みんなの回答

  • nine999
  • ベストアンサー率44% (512/1140)
回答No.1

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

appplus2
質問者

補足

ご回答ありがとうございました。 >これはどうしてdocument.write()が必要なのでしょうか? 質問ソースは一部抜粋でして、他にPHPで処理した内容をdocument.write()で書き出し htmlからJAVAスクリプトとして呼び出し動かしています。 本来であれば、PHPで直接出力といきたいのですが 質問ソースの手法でしか実現できない環境のため困っています。 どうにか質問ソースの手法で実現できないでしょうか。 よろしくお願いいたします。

すると、全ての回答が全文表示されます。

関連するQ&A