Forum Moderators: open

Message Too Old, No Replies

Need Help! Php and Java aren't playing nice together.

Php document.write and javascript

         

dmcneely

6:15 pm on Sep 23, 2004 (gmt 0)

10+ Year Member



I'm trying to add a google ad sense to my PHP page that get's pulled from my servers and it's not working. Here is the code i'm using.

function showFriends () {
var rand=Math.round(Math.random()*10000);
document.write('<a href="http://www.gamesbanner.net/work/click.php4?rnd='+rand+'" target="_blank"><img src="http://www.gamesbanner.net/work/show.php4?from=gamesofgondor&rnd='+rand+'" border="0" alt="Games Banner Network" width="100" height="100"></a>');
document.write('<scrpt type="text/javascript"><!--
google_ad_client = "pub-2816128178367254";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_color_border = "FDEFD2";
google_color_bg = "FDEFD2";
google_color_link = "0000CC";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>');
}

The javascript is conflicting showhere with the function of the Php document.write part. Any help would be GREATLy appreciated.

Thanks!
Daniel

P.S The gamesbanner.net ad is showing up fine, and i only encounter problems during googles javascript

StupidScript

7:08 pm on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome, dmcneely!

If that was a copy-and-paste from the page, then there's a typo (missing "i") in your code.

You posted:
document.write('<scrpt type="text/javascript"><!--

Should be:
document.write('<script type="text/javascript"><!--

(I'm not seeing any PHP in there ... )