Announcement

Collapse
No announcement yet.

If statement

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • If statement

    I'd like to get the code for an if statement voor my page. In the .html I put some pictures and the website shows them random. In basic it's a code voor dices. I only want to show unique pictures in a serie. With others words: you can't throw two times "3". What code do I need?

    In addition, now the code get pictures from 1 and up. So when I select 5 pictures (dices) the code only looking for the first 5 pictures (dice1, dice2 etc). In the .html stands sometimes 15 pictures. How can I get the code looking for all the 15 pictures?

    This is mij code for so far:

    $(function() {
    function n() {
    for (var n = "", t = parseInt($("#dropdown_met_aantal_plaatjes").val()), e = parseInt($("#dropdown_met_aantal_verschillende_plaatjes").val()), o = 12, a = 0; t > a; a++) {
    var i = 1 + Math.floor(Math.random() * e);
    o += i, n += "<img class='diceimg' width='400' height='400' src='/china/dice" + i + ".png' alt='Aardrijkskunde Dobbel" + i + "' />"
    }

    n += "<h2 class='total'>+ " + o + " + </h2>", $("#content").html(n), $("#content img").hide().each(function(n) {
    $(this).delay(25 * n).show(100)
    })
    }
    $(document).keypress(function(t) {
    (13 == t.which || 32 == t.which) && n()
    }), $("#shuffle_button").click(function() {
    n()
    }), $("#shuffle_button_again").click(function() {
    n()
    }), n()
    });


    I hope my questions are clear and someone can help me out. In the link you see the page with the results.
    http://meerveldfotografie.nl/dobbelsteen.html

    Grt,
    Erik
    Last edited by Reik; 06-30-2016, 05:55 PM.
Working...
X