Hi All I've created javascript code to rotate Adbrite and Adsense The Code is applied from http://blog.360.yahoo.com/blog-zwwMZhwwdrSyXD8-?p=148 var randomnumber=Math.floor(Math.random()*101) if(randomnumber>50){ // START ADBRITE ADS document.write("<!-- Begin: AdBrite --><style type=\"text/css\">.adHeadline {font: bold 10pt Arial; text-decoration: underline; color:#0000ff;}.adText {font: normal 10pt Arial; text-decoration: none; color:#000000;}</style><script type=\"text/javascript\" src=\"http://4.adbrite.com/mb/text_group.php?sid=111130&col=5&br=1&dk=776569676874206c6f73735f355f325f776562\"></script><p /><div><a class=\"adHeadline\" target=\"_top\" href=\"http://www.adbrite.com/mb/commerce/purchase_form.php?opid=111130&afsid=1\">Your Ad Here</a></div><!-- End: AdBrite -->"); // END ADBRITE ADS } else { // BEGIN ADSENSE ADS var googlead = "\ <script type=\"text/javascript\"><!--\n\ google_ad_client = \"pub-xxxxxxxxxxxxxxxxxx\";\n\ google_ad_width = 728;\n\ google_ad_height = 90;\n\ google_ad_format = \"728x90_as\";\n\ google_ad_type = \"text_image\";\n\ google_ad_channel =\"\";\n\ google_color_border = \"ffffff\";\n\ google_color_bg = \"ffffff\";\n\ google_color_link = \"0000FF\";\n\ google_color_text = \"000000\";\n\ google_color_url = \"999999\";\n\ //--><\/script>\n\ <script type=\"text/javascript\"\n\ src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n\ <\/script>\n\ "; document.write(googleads); } // END ADSENSE ADS Code (markup): It's okay when show Adbrite , but nothing display when show Adsense. The reason why i must use javascript is Invision power board template didn't allow me to insert php tag. Is there anyway to implement adsense with javascript ? Thanks
Are you able to mod the backend on invision boards. I'd say thats the only way to implement php into it
You can't use JS to display adsense adverts. They need to be hard coded (using html/php) into the page.
there is an error in the name of your variable try this: var randomnumber=Math.floor(Math.random()*101) if(randomnumber>50){ // START ADBRITE ADS document.write("<!-- Begin: AdBrite --><style type=\"text/css\">.adHeadline {font: bold 10pt Arial; text-decoration: underline; color:#0000ff;}.adText {font: normal 10pt Arial; text-decoration: none; color:#000000;}</style><script type=\"text/javascript\" src=\"http://4.adbrite.com/mb/text_group.php?sid=111130&col=5&br=1&dk=776569676874206c6f73735f355f325f776562\"></script><p /><div><a class=\"adHeadline\" target=\"_top\" href=\"http://www.adbrite.com/mb/commerce/purchase_form.php?opid=111130&afsid=1\">Your Ad Here</a></div><!-- End: AdBrite -->"); // END ADBRITE ADS } else { // BEGIN ADSENSE ADS var googleads = "\ <script type=\"text/javascript\"><!--\n\ google_ad_client = \"pub-xxxxxxxxxxxxxxxxxx\";\n\ google_ad_width = 728;\n\ google_ad_height = 90;\n\ google_ad_format = \"728x90_as\";\n\ google_ad_type = \"text_image\";\n\ google_ad_channel =\"\";\n\ google_color_border = \"ffffff\";\n\ google_color_bg = \"ffffff\";\n\ google_color_link = \"0000FF\";\n\ google_color_text = \"000000\";\n\ google_color_url = \"999999\";\n\ //--><\/script>\n\ <script type=\"text/javascript\"\n\ src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n\ <\/script>\n\ "; document.write(googleads); } // END ADSENSE ADS Code (markup):