Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: trying to find a script for a long time

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That was an entirely new page, the changes required were too complex to explain bit by bit. Copy the entire code from:

    http://www.dynamicdrive.com/forums/s...35&postcount=9

    and paste that into a text editor as a new page. Insert your images (filenames) and texts (descriptions) into this array:

    Code:
    cards[0]=["photo1.jpg", "card1 name"];
    cards[1]=["photo2.jpg", "card2 name"];
    cards[2]=["photo3.jpg", "card3 name"];
    cards[3]=["photo4.jpg", "card4 name"];
    cards[4]=["photo5.jpg", "card5 name"];
    cards[5]=["photo6.jpg", "card6 name"];
    cards[6]=["photo7.jpg", "card7 name"];
    cards[7]=["photo8.jpg", "card8 name"];
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Aug 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thats the code i have got now :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    .cent td {
    text-align:center;
    }
    </style>
    <script type="text/javascript">
    var check=[];

    function populate(){
    var ims, txt, cards=[];
    cards[0]=["01.jpg", "1"];
    cards[1]=["02.jpg", "2"];
    cards[2]=["03.jpg", "3"];
    cards[3]=["04.jpg", "4"];
    cards[4]=["05.jpg", "5"];
    cards[5]=["06.jpg", "6"];
    cards[6]=["07.jpg", "7"];
    cards[7]=["08.jpg", "8"];
    cards[8]=["09.jpg", "9"];
    cards[9]=["10.jpg", "10"];
    cards[10]=["11.jpg", "11"];
    cards[11]=["12.jpg", "12"];
    cards[12]=["13.jpg", "13"];
    cards[13]=["14.jpg", "14"];
    cards[14]=["15.jpg", "15"];
    cards[15]=["16.jpg", "16"];
    cards[16]=["17.jpg", "17"];
    cards[17]=["18.jpg", "18"];
    cards[18]=["19.jpg", "19"];
    cards[19]=["20.jpg", "20"];
    cards[20]=["21.jpg", "21"];
    cards[21]=["22.jpg", "22"];
    cards[22]=["23.jpg", "23"];
    cards[23]=["24.jpg", "24"];
    cards[24]=["25.jpg", "25"];
    cards[25]=["26.jpg", "26"];
    cards[26]=["27.jpg", "27"];
    cards[27]=["28.jpg", "28"];
    cards[28]=["29.jpg", "29"];
    cards[29]=["30.jpg", "30"];
    cards[30]=["31.jpg", "31"];
    cards[31]=["32.jpg", "32"];
    cards[32]=["33.jpg", "33"];
    cards[33]=["34.jpg", "34"];
    cards[34]=["35.jpg", "35"];
    cards[35]=["36.jpg", "36"];
    cards[36]=["37.jpg", "37"];
    cards[37]=["38.jpg", "38"];
    cards[38]=["39.jpg", "39"];
    cards[39]=["40.jpg", "40"];
    cards[40]=["41.jpg", "41"];
    cards[41]=["42.jpg", "42"];
    cards[42]=["43.jpg", "43"];
    cards[43]=["44.jpg", "44"];
    cards[44]=["45.jpg", "45"];
    cards[45]=["46.jpg", "46"];
    cards[46]=["47.jpg", "47"];
    cards[47]=["48.jpg", "48"];
    cards[48]=["49.jpg", "49"];
    cards[49]=["50.jpg", "50"];
    cards[50]=["51.jpg", "51"];
    cards[51]=["52.jpg", "52"];
    cards[52]=["53.jpg", "53"];
    cards[53]=["54.jpg", "54"];
    cards[54]=["55.jpg", "55"];
    cards[55]=["56.jpg", "56"];
    cards[56]=["57.jpg", "57"];
    cards[57]=["58.jpg", "58"];
    cards[58]=["59.jpg", "59"];
    cards[59]=["60.jpg", "60"];
    cards[60]=["61.jpg", "61"];
    cards[61]=["62.jpg", "62"];
    cards[62]=["63.jpg", "63"];
    cards[63]=["64.jpg", "64"];
    cards[64]=["65.jpg", "65"];
    cards[65]=["66.jpg", "66"];
    cards[66]=["67.jpg", "67"];
    cards[67]=["68.jpg", "68"];
    cards[68]=["69.jpg", "69"];
    cards[69]=["70.jpg", "70"];
    cards[70]=["71.jpg", "71"];
    cards[71]=["72.jpg", "72"];
    cards[72]=["73.jpg", "73"];
    cards[73]=["74.jpg", "74"];
    cards[74]=["75.jpg", "75"];
    cards[75]=["76.jpg", "76"];
    cards[76]=["77.jpg", "77"];
    cards[77]=["78.jpg", "78"];


    cards.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter)

    for (var i_tem = 0; i_tem < 3; i_tem++){
    if (check[i_tem]&&cards[i_tem][1]==check[i_tem]){
    ims=cards[i_tem+3][0];
    txt=cards[i_tem+3][1];
    }
    else {
    ims=cards[i_tem][0];
    txt=cards[i_tem][1];
    }
    document.getElementById('layout').rows[0].cells[i_tem].innerHTML='<img src="'+ims+'">';
    document.getElementById('layout').rows[1].cells[i_tem].innerHTML=txt;
    check[i_tem]=txt;
    }
    }
    onload=populate;
    </script>
    </head>
    <body>
    <p align="center">
    <input type="button" value="deal" onclick="populate();">
    </p>
    <p align="center">
    <table id="layout">
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr class="cent">
    <td></td>
    <td></td>
    <td></td>
    </tr>
    </table>
    </body>
    </html>

  3. #13
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    We just cross posted, read my previous two posts in this thread.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #14
    Join Date
    Aug 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks john-i think i've fixed it!!!!
    all works well

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
  •