Results 1 to 9 of 9

Thread: I'm new and really need help with this ad thing!!

  1. #1
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I'm new and really need help with this ad thing!!

    i've been search on the net for a week now. How do I advertise on my webpages. I mean so a different content is loaded up in the advertising box each time the page opened or refresh. There are loads of example of this kind of scripts in websites eg. advertising on yahoo and msn. the ads are normaly at the top or on the side and load randomly each time the page is loaded up. Please help someone! what kind of script do i use for this java, DHTML, CSS, or what exactly? Thanks

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    look into google ads. They give you money and are easy to setup.

    If you want that functionality for random content... take a look around DD... something should come close to what you want.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i've looked everywhere (feels like it thu). The closest thing i found was a random content text in DD.

    What I need is for a table with a specifice size on my web page to load up at random flash (.SWF) or .GIF file when the page is loaded. From like a specified folder or sumin. Please help!

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Not sure on the code myself.
    You probably want Javascript (though PHP or another server side language could work as well.)
    There are lots of "random images" and "random content" threads around. Do a serach/take a look and try to find a script that might help, or a link to one, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Check the following

    1

    2

    3

  7. #7
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Try this: (replace names img)

    <script language="JavaScript">
    images = new Array(3);
    images[0] = "<a href=/peinture/ViergeAuxCoquillages/><img src='/accueil/ViergeAuxCoquillages_accueil.jpg' border=0></a>";
    images[1] = "<a href=/dessin/ViteVite/><img src='/accueil/ViteVite_accueil.jpg' border=0></a>";
    images[2] = "<a href=/peinture/EcceHomo/><img src='/accueil/EcceHomo_accueil.jpg' border=0></a>";
    images[3] = "<a href=/dessin/Striptease/><img src='/accueil/Striptease_accueil.jpg' border=0></a>";
    index = Math.floor(Math.random() * images.length);
    document.write(images[index]);
    //done
    // --></script>

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Wrap your code in the [code] tags.

    You shouldn't put the number for the array (3) because what if the user had more than 3 sets of ads?

    You need to put type="text/javascript" in your script tag.

    What if the user doesn't use images for ad's?

    So, here's the code:

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Ad Set Code</title>
    <!-- No Script Style Code -->
    <style type="text/css">
    .ad	{
    
    	display:none;
    }
    </style>
    </head>
    
    <body>
    <!-- This is the area for ads with computers that don't support/disabled scripting ability -->
    <noscript>
    <div id="noScriptAds">Add your no-script ad code here</div>
    </noscript>
    <!-- End Area -->
    <div id="adSet1" class="ad">Ad Set 1</div>
    <div id="adSet2" class="ad">Ad Set 2</div>
    <div id="adSet3" class="ad">Ad Set 3</div>
    <script type="text/javascript">
    var adSets = 3 //How many ad sets are there
    function randomAd()	{
    
    hideAds(adSets+1)
    var i = Math.floor(Math.random() * adSets) + 1
    var adCookie = getCookie('ad')
    if (adCookie == i)	{
    setTimeout("randomAd()",1)
    }
    document.getElementById("adSet"+i).style.display = "block"
    setCookie('ad',i,1)
    }
    function hideAds(no) {
    for (i=1;i < no;i++)	{
    document.getElementById("adSet"+i).style.display = "none"
    }
    }
    function getCookie( name ) {
      var start = document.cookie.indexOf( name + "=" );
      var len = start + name.length + 1;
      if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
        return null;
      }
      if ( start == -1 ) return null;
      var end = document.cookie.indexOf( ";", len );
      if ( end == -1 ) end = document.cookie.length;
      return unescape( document.cookie.substring( len, end ) );
    }
    
    function setCookie( name, value, expires, path, domain, secure ) {
      var today = new Date();
      today.setTime( today.getTime() );
      if ( expires ) {
        expires = expires * 1000 * 60 * 60 * 24;
      }
      var expires_date = new Date( today.getTime() + (expires) );
      document.cookie = name+"="+escape( value ) +
        ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
        ( ( path ) ? ";path=" + path : "" ) +
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ( ( secure ) ? ";secure" : "" );
    }
    
    function deleteCookie( name, path, domain ) {
      if ( getCookie( name ) ) document.cookie = name + "=" +
        ( ( path ) ? ";path=" + path : "") +
        ( ( domain ) ? ";domain=" + domain : "" ) +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
    
    window.onload = randomAd;
    </script>
    </body>
    </html>
    Added: Cookie saving so ads are different every page load
    Last edited by tech_support; 11-13-2006 at 05:09 AM. Reason: New Version
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    Sep 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nice!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •