Javascript of Google inside my javascript file

Discussion in 'Javascript' started by Antonio, May 21, 2004.

  1. Antonio

    Antonio Guest

    Good Morning,
    I would want to insert the javascript of google adsense in my site,
    here it is :

    <script type="text/javascript"><!--
    google_ad_client = "pub-4902392511135327";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_channel ="";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>


    the problem is that I want to insert it inside a javascript file I
    already use in a way that I've not to insert it in every page, how can
    I do this, in expecially way, how can i formulate the

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

    when I am inside another javascript file ???

    Thanks

    Ing. Antonio D'Ottavio
    Antonio, May 21, 2004
    #1
    1. Advertising

  2. Antonio

    Ivo Guest

    "Antonio" wrote
    > Good Morning,
    > I would want to insert the javascript of google adsense in my site,
    > here it is :
    >
    > <script type="text/javascript"><!--
    > google_ad_client = "pub-4902392511135327";
    > google_ad_width = 728;
    > google_ad_height = 90;
    > google_ad_format = "728x90_as";
    > google_ad_channel ="";
    > //--></script>
    > <script type="text/javascript"
    > src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    > </script>
    >
    > the problem is that I want to insert it inside a javascript file I
    > already use in a way that I've not to insert it in every page, how


    var x=document.createElement('script');
    x.src="http://pagead";

    I think you can only create elements after the initial onload event has
    fired (and only on newer browsers), so put it in a function.
    To include the file even the before load, make an empty script tag the first
    in each document and set document.srcipts[0].src explicitly in your own .js
    file (IE only I think).
    HTH
    Ivo
    Ivo, May 21, 2004
    #2
    1. Advertising

  3. Antonio

    Antonio Guest

    I made this :

    function InserisciFooter()
    {
    document.write('<img src="' + base + 'images/barraFooter.png"
    width="750" align="center">');

    google_ad_client = "pub-4902392511135327";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_channel ="";
    google_ad_type = "text_image";
    google_color_border = ["B4D0DC","A8DDA0","578A24"];
    google_color_bg = ["ECF8FF","EBFFED","CCFF99"];
    google_color_link = ["0000CC","0000CC","00008B"];
    google_color_url = ["008000","008000","00008B"];
    google_color_text = ["6F6F6F","6F6F6F","000000"];
    var x=document.createElement('script');
    x.src="http://pagead2.googlesyndication.com/pagead/show_ads.js";
    };

    but there is nothing in the resulting page,
    have you an idea of other solution ???

    Thanks in any case



    "Ivo" <> wrote in message news:<40adad88$0$72192$>...
    > "Antonio" wrote
    > > Good Morning,
    > > I would want to insert the javascript of google adsense in my site,
    > > here it is :
    > >
    > > <script type="text/javascript"><!--
    > > google_ad_client = "pub-4902392511135327";
    > > google_ad_width = 728;
    > > google_ad_height = 90;
    > > google_ad_format = "728x90_as";
    > > google_ad_channel ="";
    > > //--></script>
    > > <script type="text/javascript"
    > > src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    > > </script>
    > >
    > > the problem is that I want to insert it inside a javascript file I
    > > already use in a way that I've not to insert it in every page, how

    >
    > var x=document.createElement('script');
    > x.src="http://pagead";
    >
    > I think you can only create elements after the initial onload event has
    > fired (and only on newer browsers), so put it in a function.
    > To include the file even the before load, make an empty script tag the first
    > in each document and set document.srcipts[0].src explicitly in your own .js
    > file (IE only I think).
    > HTH
    > Ivo
    Antonio, May 21, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson

    FAQ - references to Google/Google Groups

    Andrew Thompson, Jun 20, 2005, in forum: Java
    Replies:
    0
    Views:
    594
    Andrew Thompson
    Jun 20, 2005
  2. Replies:
    2
    Views:
    2,011
    Jeffrey Schwab
    Nov 28, 2005
  3. David Dorward
    Replies:
    1
    Views:
    2,105
    Isofarro
    Jun 28, 2003
  4. Krice
    Replies:
    9
    Views:
    276
    Default User
    Apr 25, 2008
  5. JSH
    Replies:
    0
    Views:
    361
Loading...

Share This Page