Click here to Skip to main content
15,891,253 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: A question to dust_dex Pin
Hakan Bulut24-Mar-13 21:13
Hakan Bulut24-Mar-13 21:13 
GeneralRe: A question to dust_dex Pin
dusty_dex24-Mar-13 21:53
dusty_dex24-Mar-13 21:53 
GeneralRe: A question to dust_dex Pin
Hakan Bulut24-Mar-13 23:47
Hakan Bulut24-Mar-13 23:47 
GeneralRe: A question to dust_dex Pin
Hakan Bulut25-Mar-13 1:11
Hakan Bulut25-Mar-13 1:11 
GeneralRe: A question to dust_dex Pin
dusty_dex25-Mar-13 7:25
dusty_dex25-Mar-13 7:25 
GeneralRe: A question to dust_dex Pin
Hakan Bulut25-Mar-13 3:21
Hakan Bulut25-Mar-13 3:21 
GeneralRe: A question to dust_dex Pin
Hakan Bulut25-Mar-13 3:22
Hakan Bulut25-Mar-13 3:22 
GeneralRe: A question to dust_dex Pin
dusty_dex25-Mar-13 8:53
dusty_dex25-Mar-13 8:53 
replace with this.
JavaScript
<script>
    // create and initialise - array to keep track of any number taken
    var taken = new Array(49);
    for (var i=49; i>0; i--) taken[i]=false;

    var lucky = [];
    var rec = ["19","20","21","40","41","45","12","23","34","36","37","46"];
    document.write("Weekly records for 2 week : ");
    for(var i=0; i<12; i++) {
        document.write(rec[i] + ",");
    }

    document.write("<br><hr>");

    var z=0;
    do {
        var q = Math.round(11 * Math.random());
        if(!taken[ rec[q] ]) {
            lucky[z] = rec[q];
            taken[ rec[q] ] = true;
            document.write(lucky[z] + "<br>");
            z++;       
        }
    } while (z < 6);
</script>


this line:
if(!taken[ rec[q] ]) 
checks if NOT taken (! = not)
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan

That's what machines are for.

Got a problem?
Sleep on it.

GeneralRe: A question to dust_dex Pin
Hakan Bulut25-Mar-13 21:21
Hakan Bulut25-Mar-13 21:21 
GeneralRe: A question to dust_dex Pin
dusty_dex25-Mar-13 11:58
dusty_dex25-Mar-13 11:58 
GeneralRe: A question to dust_dex Pin
Hakan Bulut26-Mar-13 21:58
Hakan Bulut26-Mar-13 21:58 
GeneralRe: A question to dust_dex Pin
dusty_dex27-Mar-13 8:14
dusty_dex27-Mar-13 8:14 
GeneralRe: A question to dust_dex Pin
Hakan Bulut27-Mar-13 21:02
Hakan Bulut27-Mar-13 21:02 
QuestionNeed to read xml from HTTPS to HTTP Server Pin
satyam_8318-Mar-13 22:07
satyam_8318-Mar-13 22:07 
AnswerRe: Need to read xml from HTTPS to HTTP Server Pin
SoMad18-Mar-13 23:09
professionalSoMad18-Mar-13 23:09 
GeneralRe: Need to read xml from HTTPS to HTTP Server Pin
Marco Bertschi19-Mar-13 2:30
protectorMarco Bertschi19-Mar-13 2:30 
AnswerRe: Need to read xml from HTTPS to HTTP Server Pin
Marco Bertschi19-Mar-13 2:29
protectorMarco Bertschi19-Mar-13 2:29 
QuestionNeed to read xml from HTTPS to HTTP Server Pin
satyamshilpi18-Mar-13 21:45
satyamshilpi18-Mar-13 21:45 
AnswerRe: Need to read xml from HTTPS to HTTP Server Pin
Marco Bertschi19-Mar-13 2:29
protectorMarco Bertschi19-Mar-13 2:29 
AnswerRe: Need to read xml from HTTPS to HTTP Server Pin
dusty_dex19-Mar-13 8:59
dusty_dex19-Mar-13 8:59 
QuestionMoveMenuItems Pin
Dungas17-Mar-13 20:56
Dungas17-Mar-13 20:56 
AnswerRe: MoveMenuItems Pin
jkirkerx18-Mar-13 8:14
professionaljkirkerx18-Mar-13 8:14 
AnswerRe: MoveMenuItems Pin
Moykn2-Apr-13 2:32
Moykn2-Apr-13 2:32 
Questionhow to show unique number in the form ,and after submit when next time a user will enter it will show another unique number Pin
Member 824369316-Mar-13 2:18
Member 824369316-Mar-13 2:18 
AnswerRe: how to show unique number in the form ,and after submit when next time a user will enter it will show another unique number Pin
ZurdoDev19-Mar-13 2:20
professionalZurdoDev19-Mar-13 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.