1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Using external coding to improve search engine placement?

Discussion in 'JavaScript' started by dougadam, Oct 3, 2005.

  1. #1
    Does anyone know of any online tutorials for making an external JavaScript file?



    SEMrush
     
    dougadam, Oct 3, 2005 IP
    SEMrush
  2. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #2
    ???

    What do you want to accomplish?
    if you want to "include" an external javascript file:
    <SCRIPT LANGUAGE="JAVASCRIPT" SRC="http://www.whatever/bla.js"></SCRIPT>

    and the bla.js should contain just Javascript (No<SCRIPT> tags)
     
    frankm, Oct 3, 2005 IP
  3. dougadam

    dougadam Active Member

    Messages:
    495
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Let’s say I have a website with 1000 pages, and on each page I have an affiliate ad. But after a while the affiliate ad does not workout. So I decide to change affiliates. At present I would have to go thru all 1000 pages and change the code.

    I have heard there is a way to put the ad in an external file. Then make a reference to it on the 1000 pages. So that if you want to change the ad, all you would have to do is change the external file.

    Any help would be appreciated.
     
    dougadam, Oct 4, 2005 IP
  4. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #4
    @dougadam:

    if you are using PHP, you can use
    include "ads.html";
    PHP:
    or something like that. but if you don't use any server side parsing, you can do the same with Javascript (client side). Create a simple file called ads.js in your server root dir
    document.write('<B>Advertisement</B>');
    Code (markup):
    and include it in all the pages you need with
    <script language="javascript" src="http://www.domain.tld/ads.js"></script>
    HTML:
    hope this helps.
     
    frankm, Oct 4, 2005 IP
  5. dougadam

    dougadam Active Member

    Messages:
    495
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Would this be possible with my google adsense ad?

    <script type="text/javascript"><!--
    google_ad_client = "pub-8654735634445568";
    google_ad_width = 250;
    google_ad_height = 250;
    google_ad_format = "250x250_as";
    google_ad_type = "text_image";
    google_ad_channel ="";
    google_color_border = "B0E0E6";
    google_color_bg = "FFFFFF";
    google_color_link = "000000";
    google_color_url = "336699";
    google_color_text = "333333";
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
     
    dougadam, Oct 4, 2005 IP
  6. worldpar

    worldpar Peon

    Messages:
    9
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks, Frankm that is something I have been searching for also!
    (I love this forum)

    Unless there is something special about google adsense it should work just fine using this line of code as well. (right?)
    Or would you have to change it to.... <SCRIPT LANGUAGE="TEXT/JAVASCRIPT" SRC="http://www.whatever/bla.js"></SCRIPT>
     
    worldpar, Oct 6, 2005 IP
  7. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #7
    both are possible but <script language="javascript"> ... </script> works fine

    More info: w3c.org
     
    frankm, Oct 6, 2005 IP
  8. worldpar

    worldpar Peon

    Messages:
    9
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Just a follow up.
    I did just excatly what was said and everythiing worked fine. But...
    when I ran my page at w3c.org I got this error (Error Line 9 column 113: required attribute "TYPE" not specified.
    ...ifts_scripts/gifts_scripts_window.js"></SCRIPT>)

    I had... <SCRIPT LANGUAGE="JAVASCRIPT" SRC="http://www.xyz.com/file.js"></SCRIPT>

    I changed it to... <SCRIPT LANGUAGE="TEXT/JAVASCRIPT" SRC="http://www.xyz.com/file.js"></SCRIPT>
    But still got the error.

    So I changed it to... <script language="javascript" type="text/javascript" SRC="http://www.xyz.com/file.js"></SCRIPT>
    And it went through w3c.org without a hitch
     
    worldpar, Oct 6, 2005 IP