By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,628 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,628 IT Pros & Developers. It's quick & easy.

Correct code - help.

P: n/a
Hi,

I run a site with Google's AdSense adds and would like to put the following
two scripts into a single, external .js file.

1. Does anybody know if having this external js affects the adds being
displayed or any other problem?
2. Can you help me to get that rigth?

Thanks in advance,
C.

<script type="text/javascript"><!--
google_ad_client = "pub-number";
google_alternate_color = "FFFFFF";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_url = "006600";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Claire Lescarret" <cl*****@nul.com> wrote in message
news:1112338663.777036cc09c1ff7dab20f2858d9aef00@t eranews...
Hi,

I run a site with Google's AdSense adds and would like to put the following two scripts into a single, external .js file.

1. Does anybody know if having this external js affects the adds being
displayed or any other problem?
2. Can you help me to get that rigth?

Thanks in advance,
C.


Why? Google may change their ".js" at any time.

http://pagead2.googlesyndication.com/pagead/show_ads.js
Why not just put your code (below) in a second "include" file?

google_ad_client = "pub-number";
google_alternate_color = "FFFFFF";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_url = "006600";
google_color_text = "000000";
Jul 23 '05 #2

P: n/a
On 4/1/05 6:39 AM, McKirahan wrote 74********************@comcast.com:

Why? Google may change their ".js" at any time.
That's true, thank you.
Why not just put your code (below) in a second "include" file?

What is "include"? Does that mean any different from having the code inside
html files?
google_ad_client = "pub-number";
google_alternate_color = "FFFFFF";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_url = "006600";
google_color_text = "000000";


Thank you for your time,
C.

Jul 23 '05 #3

P: n/a
"Claire Lescarret" <cl*****@nul.com> wrote in message
news:1112509071.3a4ac1b7eaa5824b15ee9f2b5ed2ab6f@t eranews...
On 4/1/05 6:39 AM, McKirahan wrote 74********************@comcast.com:

Why? Google may change their ".js" at any time.
That's true, thank you.
Why not just put your code (below) in a second "include" file?


What is "include"? Does that mean any different from having the code

inside html files?
google_ad_client = "pub-number";
google_alternate_color = "FFFFFF";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_url = "006600";
google_color_text = "000000";


Thank you for your time,
C.


A JavaScript "include" is putting code in a separate file which will allow
its easy reuse.

Google does this via

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

You can do this by placing the following in, say, "myGoogle.js"":

google_ad_client = "pub-number";
google_alternate_color = "FFFFFF";
google_ad_width = 120;
google_ad_height = 240;
google_ad_format = "120x240_as";
google_ad_channel ="";
google_ad_type = "text";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF6600";
google_color_url = "006600";
google_color_text = "000000";

and the using this in your Web page:

<script type="text/javascript" src="myGoogle.js"></script>
To reuse it on other pages all you have to do is include 2 lines:

<script type="text/javascript" src="myGoogle.js"></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.