My Random Ads Dont Work!?

Discussion in 'HTML & Website Design' started by surfer33, Aug 30, 2007.

  1. #1
    why?


    <form name="myFormName" method="get" action=" ">
    <noscript>
    <div>
    turned ON SCRIPTS
    </div>
    </noscript>
    <script type="text/javascript">
    function displayRandomAd()
    {
    //store the adverts in arrays
    heading = new Array();
    theAdText = new Array();

    heading[0] = "<script type="text/javascript"><!--
    ch_client = "xxxx";
    ch_width = 250;
    ch_height = 250;
    var ch_queries = new Array( "phone" );
    var ch_selected=Math.floor((Math.random()*ch_queries.length));
    if ( ch_selected < ch_queries.length ) {
    ch_query = ch_queries[ch_selected];
    }
    //--></script>
    <script src="http://scripts.chitika.net/eminimalls/mm.js" type="text/javascript">
    </script>";
    theAdText[0] = ""
    + "";

    heading[1] = "<script type="text/javascript"><!--
    ch_client = "xxxx";
    ch_width = 250;
    ch_height = 250;
    var ch_queries = new Array( "labtop" );
    var ch_selected=Math.floor((Math.random()*ch_queries.length));
    if ( ch_selected < ch_queries.length ) {
    ch_query = ch_queries[ch_selected];
    }
    //--></script>
    <script src="http://scripts.chitika.net/eminimalls/mm.js" type="text/javascript">
    </script>";
    theAdText[1] = ""
    + "";

    heading[2] = "<script type="text/javascript"><!--
    ch_client = "xxxx";
    ch_width = 250;
    ch_height = 250;
    var ch_queries = new Array( "camera" );
    var ch_selected=Math.floor((Math.random()*ch_queries.length));
    if ( ch_selected < ch_queries.length ) {
    ch_query = ch_queries[ch_selected];
    }
    //--></script>
    <script src="http://scripts.chitika.net/eminimalls/mm.js" type="text/javascript">
    </script>";
    theAdText[2] = ""
    + "";


    //calculate a random index
    // NB the more ads you have, the less likely it is to see the same one twice in a row
    index = Math.floor(Math.random() * theAdText.length);

    //display the ad
    document.write( ''
    + '<h4> ' + heading[index] + '<\/h4>'
    + '<p>' + theAdText[index] + '\n' + '<\/p>'
    );
    //done
    }
    </script>
    <script type="text/javascript">
    displayRandomAd();
    </script>
    </form>
     
    surfer33, Aug 30, 2007 IP
  2. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #2
    I'd guess cause of all the "" in there and no \ to cancel them out.

    If it's not that then i'll take a better look
     
    twistedspikes, Aug 30, 2007 IP
  3. surfer33

    surfer33 Banned

    Messages:
    212
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    plz give me a full script and explain more....
     
    surfer33, Aug 31, 2007 IP
  4. surfer33

    surfer33 Banned

    Messages:
    212
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    plz help me.........................
     
    surfer33, Aug 31, 2007 IP
  5. andytomas99

    andytomas99 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    :confused:
     
    andytomas99, Aug 31, 2007 IP
  6. surfer33

    surfer33 Banned

    Messages:
    212
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ?????????????????
    what?
     
    surfer33, Aug 31, 2007 IP
  7. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #7
    It's not rocket science that if you have a variable saying variable="Whatever" then if the Whatever part has "s in it then it will stop the variable short of what you want.

    Fixed it up there anyway. I accept all forms of rep :p
     
    twistedspikes, Aug 31, 2007 IP
  8. surfer33

    surfer33 Banned

    Messages:
    212
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    can u fix my given code?
    plz give me a full code(fixed script 4 random ads)
     
    surfer33, Aug 31, 2007 IP
  9. surfer33

    surfer33 Banned

    Messages:
    212
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    any body here ????????????????????????
     
    surfer33, Aug 31, 2007 IP