Correct code - help.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Claire Lescarret

    Correct code - help.

    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_clien t = "pub-number";
    google_alternat e_color = "FFFFFF";
    google_ad_width = 120;
    google_ad_heigh t = 240;
    google_ad_forma t = "120x240_as ";
    google_ad_chann el ="";
    google_ad_type = "text";
    google_color_bo rder = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_li nk = "FF6600";
    google_color_ur l = "006600";
    google_color_te xt = "000000";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googles yndication.com/pagead/show_ads.js">
    </script>


  • McKirahan

    #2
    Re: Correct code - help.

    "Claire Lescarret" <clairel@nul.co m> wrote in message
    news:1112338663 .777036cc09c1ff 7dab20f2858d9ae f00@teranews...[color=blue]
    > Hi,
    >
    > I run a site with Google's AdSense adds and would like to put the[/color]
    following[color=blue]
    > 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.[/color]

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




    Why not just put your code (below) in a second "include" file?

    google_ad_clien t = "pub-number";
    google_alternat e_color = "FFFFFF";
    google_ad_width = 120;
    google_ad_heigh t = 240;
    google_ad_forma t = "120x240_as ";
    google_ad_chann el ="";
    google_ad_type = "text";
    google_color_bo rder = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_li nk = "FF6600";
    google_color_ur l = "006600";
    google_color_te xt = "000000";


    Comment

    • Claire Lescarret

      #3
      Re: Correct code - help.

      On 4/1/05 6:39 AM, McKirahan wrote 74idnZ-p74V-3dDfRVn-qQ@comcast.com:
      [color=blue]
      >
      > Why? Google may change their ".js" at any time.[/color]

      That's true, thank you.
      [color=blue]
      > Why not just put your code (below) in a second "include" file?
      >[/color]

      What is "include"? Does that mean any different from having the code inside
      html files?
      [color=blue]
      > google_ad_clien t = "pub-number";
      > google_alternat e_color = "FFFFFF";
      > google_ad_width = 120;
      > google_ad_heigh t = 240;
      > google_ad_forma t = "120x240_as ";
      > google_ad_chann el ="";
      > google_ad_type = "text";
      > google_color_bo rder = "FFFFFF";
      > google_color_bg = "FFFFFF";
      > google_color_li nk = "FF6600";
      > google_color_ur l = "006600";
      > google_color_te xt = "000000";
      >[/color]

      Thank you for your time,
      C.

      Comment

      • McKirahan

        #4
        Re: Correct code - help.

        "Claire Lescarret" <clairel@nul.co m> wrote in message
        news:1112509071 .3a4ac1b7eaa582 4b15ee9f2b5ed2a b6f@teranews...[color=blue]
        > On 4/1/05 6:39 AM, McKirahan wrote 74idnZ-p74V-3dDfRVn-qQ@comcast.com:
        >[color=green]
        > >
        > > Why? Google may change their ".js" at any time.[/color]
        >
        > That's true, thank you.
        >[color=green]
        > > Why not just put your code (below) in a second "include" file?
        > >[/color]
        >
        > What is "include"? Does that mean any different from having the code[/color]
        inside[color=blue]
        > html files?
        >[color=green]
        > > google_ad_clien t = "pub-number";
        > > google_alternat e_color = "FFFFFF";
        > > google_ad_width = 120;
        > > google_ad_heigh t = 240;
        > > google_ad_forma t = "120x240_as ";
        > > google_ad_chann el ="";
        > > google_ad_type = "text";
        > > google_color_bo rder = "FFFFFF";
        > > google_color_bg = "FFFFFF";
        > > google_color_li nk = "FF6600";
        > > google_color_ur l = "006600";
        > > google_color_te xt = "000000";
        > >[/color]
        >
        > Thank you for your time,
        > C.
        >[/color]

        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.googles yndication.com/pagead/show_ads.js"></script>

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

        google_ad_clien t = "pub-number";
        google_alternat e_color = "FFFFFF";
        google_ad_width = 120;
        google_ad_heigh t = 240;
        google_ad_forma t = "120x240_as ";
        google_ad_chann el ="";
        google_ad_type = "text";
        google_color_bo rder = "FFFFFF";
        google_color_bg = "FFFFFF";
        google_color_li nk = "FF6600";
        google_color_ur l = "006600";
        google_color_te xt = "000000";

        and the using this in your Web page:

        <script type="text/javascript" src="myGoogle.j s"></script>


        To reuse it on other pages all you have to do is include 2 lines:

        <script type="text/javascript" src="myGoogle.j s"></script>
        <script type="text/javascript"
        src="http://pagead2.googles yndication.com/pagead/show_ads.js"></script>


        Comment

        Working...