使用基于随机播放的数字附加变量

时间:2019-06-18 20:27:14

标签: javascript jquery html

我正在尝试创建测验,并且完成了大部分脚本。

测验询问是否某些东西是字母,用户可以选择是/否。如果正确,则会附加更多更具体的答案。

即,如果字母为b,则第一个答案为是,它是字母,

第二组问题是:这个字母是a-m还是m-z。如果选择a-m,则会发出您正确的警报;如果选择m-z,则会出现错误,提示您不正确。

如果选择正确,将附加6个其他选项:

  • 字母比M更靠近A
  • 字母比Z更接近M
  • 字母是N
  • 字母比N更接近Z
  • 我需要另一个选择的示例,但您不应该选择我,因为我错了
  • 以字母B为例,-正确的选项是“字母比M更靠近A”。

    所有这些现在都可以用,

    我希望最后6个选项以重新排列的顺序附加。

    我在页面上的其他地方都使用了shuffle,但是我不能完全将它们进行洗牌并可以单击,但是当我能够对它们进行洗牌时,单击效果不一样:( 此第一个代码有效,除了不尝试对最后的选择进行任何改组。

    const sTart =  "<button class='btn btn-success active' id='" 
    const sTart2 = "<button class='btn btn-warning active' id='"
    const sTart3 = "<button class='btn btn-danger active' id='" 
    const sTart4 = "<button class='btn btn-dark active' id='" 
    const cLose =  "'>"
    const cSpan =  '</button>'
    
    
    
    $(document).ready(function () {  
      $('#ArrayD').append(obj[1].fruit)
                 $('#YES').click(function()
      {
        if (obj[1].absolute == "YES") 
          {
            alert ("Yes, but where does it belong in the alphabet?")
                    $('#secondStep').append("<h2><b>" + obj[1].fruit + " belongs in the following group of letters" + "<br></h2></b>" +sTart + obj[1].belong1 + cLose +  obj[1].belong1 +cSpan + " " + sTart + obj[1].belong2 + cLose + obj[1].belong2 + cSpan)
          }
           else {
            alert ("The selected answer is incorrect. Please try again.")
      }
    
    $('#A-M').click(function()
      { 
          if (obj[1].belong1 == obj[1].belong3) {
            alert ("Your on the right track!")
      $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + 
              sTart2 + obj[1].belong4a + cLose + obj[1].belong4 + cSpan +  " " +
              sTart3 + obj[1].belong5a + cLose + obj[1].belong5 + cSpan +   " " +
              sTart4 + obj[1].belong6a + cLose + obj[1].belong6 + cSpan + " <br><br>" +
              sTart + obj[1].belong7a + cLose + obj[1].belong7 + cSpan +  " " +
              sTart2 + obj[1].belong8a + cLose + obj[1].belong8 + cSpan) 
          }
          else { alert ("That is not quite right")}
    
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    $('#N-Z').click(function()
      { 
          if (obj[1].belong2 == obj[1].belong3) {
            alert ("Your on the right track!")
             $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + 
              sTart2 + obj[1].belong4a + cLose + obj[1].belong4 + cSpan +  " " +
              sTart3 + obj[1].belong5a + cLose + obj[1].belong5 + cSpan +   " " +
              sTart4 + obj[1].belong6a + cLose + obj[1].belong6 + cSpan + " <br><br>" +
              sTart + obj[1].belong7a + cLose + obj[1].belong7 + cSpan +  " " +
              sTart2 + obj[1].belong8a + cLose + obj[1].belong8 + cSpan) 
           }
          else { alert ("That is not quite right")}
            
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    
      });
        });
    
    
    
    $(document).ready(function () {  
            $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    });
                
    
    
    var obj = [{
        "fruit": "B",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 1,
        "belong1": "A-M",//choice
        "belong2": "N-Z",//choice
        "belong3": "A-M",//answer
        "belong4": "The letter is closer to A than M",//choice2
        "belong5": "The letter is closer to M than A",//choice2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//choice2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//choice2
        "belong9": "The letter is closer to A than M",//answer2
        "belong4a": "4a",
        "belong5a": "5a",
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoAthanM"//spanid answer
    
    
    
      },
         {
        "fruit": "n",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 2,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",//c2
        "belong5": "The letter is closer to M than A",//c2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//c2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//c2
        "belong9": "The letter is N",//answer 2
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisN"
      },
      {
        "fruit": "x",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 3,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoZthanN"
    
      },
        {
        "fruit": 1,
        "absolute": "NO",
        "exclamationEqual":"YES",
        "position": 4,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "Supercalifragilisticexpialadocious",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "If you got this to come up, you definitely cheated...",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "Ifyougotthistocomeup,youdefinitelycheated"
      }
        ]
    ;
    
    obj.sort(function (a, b) {return Math.random() - 0.5;});
    
    
    ///
    // $(document).ready(function () {  
    
    
    //    });
    <html>
    <head>
      <title>Quiz </title>
    
    <!-- Bootstrap CSS  & JS--> 
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
      
    <!-- Jquery --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
    <!--Toastr Min CSS --> 
    <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css'> 
    
    <!--Toastr Min JS --> 
    <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js'></script>
    <!--Font Awesome --> 
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
    
    <!-- Custom JS and CSS -->
     <script src="./scripts/Jquiz2.2working.js"></script>
    <!-- End Custom JS and CSS -->
    <style>
    body {padding-top:5%; margin-left:5%;}
    </style>
    
    </head>
    <body>
    <div>
    
    Is:<br>
                        <br><h1><b><span id="ArrayD" style="border:dashed;padding:5px;"> </span></b></h1> a letter of the alphabet?
    
    <div id="btns">
     <br>
    <button class="btn btn-info active" caption="Yes" id="YES"> Yes</button> <button class="btn btn-info active" caption="No" id="NO"> No</button>
    </div>
    <br>
    <br>
    
    <span id ="secondStep"></span>
    <br>
    <br>
    <span id ="thirdStep"></span>
    
    	</body>
    
    </html>

    在我的代码中,B是最好的选择,“ 1”的作用不大。

    这是我尝试但没有起作用的方法。(请继续运行直到“ B”显示为字母”)

    const sTart =  "<button class='btn btn-success active' id='" 
    const sTart2 = "<button class='btn btn-warning active' id='"
    const sTart3 = "<button class='btn btn-danger active' id='" 
    const sTart4 = "<button class='btn btn-dark active' id='" 
    const cLose =  "'>"
    const cSpan =  '</button>'
    
    
    
    
      var a = [4, 5, 6, 7,8];
    a.sort(function (a, b) {return Math.random() - 0.5;});
    
    ;
    const fFirst = a[0];
    const sSecond = a[1];
    const tThird = a[2];
    const fFourth = a[3];
    const fFifth = a[4]; 
    
    
    
    const belongFour = "obj[1].belong" + fFirst;
    const belongFive = "obj[1].belong" + sSecond;
    const belongSix = "obj[1].belong" + tThird;
    const belongSeven = "obj[1].belong" + fFourth;
    const belongEight = "obj[1].belong" + fFifth;
    
    const belongFourA = "obj[1].belong" + fFirst + "a";
    const belongFiveA = "obj[1].belong" + sSecond + "a";
    const belongSixA = "obj[1].belong" + tThird + "a";
    const belongSevenA = "obj[1].belong" + fFourth + "a";
    const belongEightA = "obj[1].belong" + fFifth + "a";
    
    
    
    $(document).ready(function () {  
      $('#ArrayD').append(obj[1].fruit)
                 $('#YES').click(function()
      {
        if (obj[1].absolute == "YES") 
          {
            alert ("Yes, but where does it belong in the alphabet?")
                    $('#secondStep').append("<h2><b>" + obj[1].fruit + " belongs in the following group of letters" + "<br></h2></b>" +sTart + obj[1].belong1 + cLose +  obj[1].belong1 +cSpan + " " + sTart + obj[1].belong2 + cLose + obj[1].belong2 + cSpan)
          }
           else {
            alert ("The selected answer is incorrect. Please try again.")
      }
    
    $('#A-M').click(function()
      { 
          if (obj[1].belong1 == obj[1].belong3) {
            alert ("Your on the right track!")
      $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + "<span id='thirdStepA'> </span>" + "<br>");
          
          
          $("#thirdStepA").append(
              sTart2 + obj[1].belong4a + cLose + belongFour + cSpan +  " " +
              sTart3 + obj[1].belong5a + cLose + belongFive + cSpan +   " " +
              sTart4 + obj[1].belong6a + cLose + belongSix + cSpan + " <br><br>" +
              sTart + obj[1].belong7a + cLose + belongSeven + cSpan +  " " +
              sTart2 + obj[1].belong8a + cLose + belongEight + cSpan) }
         
          else { alert ("That is not quite right")}
    
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    $('#N-Z').click(function()
      { 
          if (obj[1].belong2 == obj[1].belong3) {
            alert ("Your on the right track!")
             $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + 
              sTart2 + obj[1].belong4a + cLose + obj[1].belong4 + cSpan +  " " +
              sTart3 + obj[1].belong5a + cLose + obj[1].belong5 + cSpan +   " " +
              sTart4 + obj[1].belong6a + cLose + obj[1].belong6 + cSpan + " <br><br>" +
              sTart + obj[1].belong7a + cLose + obj[1].belong7 + cSpan +  " " +
              sTart2 + obj[1].belong8a + cLose + obj[1].belong8 + cSpan) 
           }
          else { alert ("That is not quite right")}
            
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    
      });
        });
    
    
    
    $(document).ready(function () {  
            $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    });
                
    
    
    var obj = [{
        "fruit": "B",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 1,
        "belong1": "A-M",//choice
        "belong2": "N-Z",//choice
        "belong3": "A-M",//answer
        "belong4": "The letter is closer to A than M",//choice2
        "belong5": "The letter is closer to M than A",//choice2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//choice2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//choice2
        "belong9": "The letter is closer to A than M",//answer2
        "belong4a": "4a",
        "belong5a": "5a",
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoAthanM"//spanid answer
    
    
    
      },
         {
        "fruit": "n",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 2,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",//c2
        "belong5": "The letter is closer to M than A",//c2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//c2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//c2
        "belong9": "The letter is N",//answer 2
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisN"
      },
      {
        "fruit": "x",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 3,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoZthanN"
    
      },
        {
        "fruit": 1,
        "absolute": "NO",
        "exclamationEqual":"YES",
        "position": 4,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "Supercalifragilisticexpialadocious",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "If you got this to come up, you definitely cheated...",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "Ifyougotthistocomeup,youdefinitelycheated"
      }
        ]
    ;
    
    obj.sort(function (a, b) {return Math.random() - 0.5;});
    
    
    ///
    // $(document).ready(function () {  
    
    
    //    });
    <html>
    <head>
      <title>Quiz </title>
    
    <!-- Bootstrap CSS  & JS--> 
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
      
    <!-- Jquery --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
    <!--Toastr Min CSS --> 
    <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css'> 
    
    <!--Toastr Min JS --> 
    <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js'></script>
    <!--Font Awesome --> 
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
    
    <!-- Custom JS and CSS -->
     <script src="./scripts/Jquiz2.2working.js"></script>
    <!-- End Custom JS and CSS -->
    <style>
    body {padding-top:5%; margin-left:5%;}
    </style>
    
    </head>
    <body>
    <div>
    
    Is:<br>
                        <br><h1><b><span id="ArrayD" style="border:dashed;padding:5px;"> </span></b></h1> a letter of the alphabet?
    
    <div id="btns">
     <br>
    <button class="btn btn-info active" caption="Yes" id="YES"> Yes</button> <button class="btn btn-info active" caption="No" id="NO"> No</button>
    </div>
    <br>
    <br>
    
    <span id ="secondStep"></span>
    <br>
    <br>
    <span id ="thirdStep"></span>
    
    	</body>
    
    </html>

    1 个答案:

    答案 0 :(得分:0)

    与其尝试插入经过改组的数组中的数字,不如创建一个新的数组以进行改组,然后从中进行附加,就像您最初进行附加操作一样。

    C:\Users\Art\android-ndk-r20/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -D__ANDROID_API__=16 -target i686-none-linux-android -mstackrealign -gcc-toolchain C:\Users\Art\android-ndk-r20/toolchains/x86-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot=C:\Users\Art\android-ndk-r20/platforms/android-16/arch-x86/ -Wl,-soname,libcalculator-qml.so -Wl,-rpath=C:/Qt/5.12.4/android_x86/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libcalculator-qml.so calculator-qml.obj Button_qml.obj calculator-qml_qml.obj qmlcache_loader.obj statemachine.obj   C:/Qt/5.12.4/android_x86/lib/libQt5Gui.so -Lc:\Utils\Android\android-ndk-r19c/sources/cxx-stl/llvm-libc++/libs/x86 C:/Qt/5.12.4/android_x86/lib/libQt5Scxml.so C:/Qt/5.12.4/android_x86/lib/libQt5Qml.so C:/Qt/5.12.4/android_x86/lib/libQt5Network.so C:/Qt/5.12.4/android_x86/lib/libQt5Core.so -lGLESv2  -LC:\Users\Art\android-ndk-r20/sources/cxx-stl/llvm-libc++/libs/x86 
    
    const sTart =  "<button class='btn btn-success active' id='" 
    const sTart2 = "<button class='btn btn-warning active' id='"
    const sTart3 = "<button class='btn btn-danger active' id='" 
    const sTart4 = "<button class='btn btn-dark active' id='"
    const sTart5 =  "<button class='btn btn-secondary active' id='"
    const cLose =  "'>"
    const cSpan =  '</button>'
    
    
    $(document).ready(function () {  
      $('#ArrayD').append(obj[1].fruit)
                 $('#YES').click(function()
      {
        if (obj[1].absolute == "YES") 
          {
            alert ("Yes, but where does it belong in the alphabet?")
                    $('#secondStep').append("<h2><b>" + obj[1].fruit + " belongs in the following group of letters" + "<br></h2></b>" +sTart + obj[1].belong1 + cLose +  obj[1].belong1 +cSpan + " " + sTart + obj[1].belong2 + cLose + obj[1].belong2 + cSpan)
          }
           else {
            alert ("The selected answer is incorrect. Please try again.")
      }
    
    $('#A-M').click(function()
      { 
          if (obj[1].belong1 == obj[1].belong3) {
            alert ("Your on the right track!")
      $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + "<div id='thirdStepA'> </div>" + "<br>");
          //i append a div with thirdstepA
          
          $("#thirdStepA").append(sTart5 +a[0].append + a[0].fruit + cLose + " " + cSpan);
     $('#thirdStepA').append(sTart + a[1].append + a[1].fruit + cLose + " " + cSpan);
     $('#thirdStepA').append(sTart2 +a[2].append + a[2].fruit + cLose + " " + cSpan + "<br><br>");
     $('#thirdStepA').append(sTart3  +a[3].append + a[3].fruit + cLose + " " +cSpan);
      $('#thirdStepA').append(sTart4 +a[4].append + a[4].fruit + cLose + " " + cSpan);
       
    
    //inside thirdstepA I append 4 spans named append 0-4 (5 options).
    
     $('#append1').append(a[0].fruitname);
     $('#append2').append(a[1].fruitname);
     $('#append3').append(a[2].fruitname);
     $('#append4').append(a[3].fruitname);
      $('#append5').append(a[4].fruitname);
       
    
    //inside the spans i append the fruitname based on the shuffle, viola . shuffle.
    
             }
         
          else { alert ("That is not quite right")}
    
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    $('#N-Z').click(function()
      { 
          if (obj[1].belong2 == obj[1].belong3) {
            alert ("Your on the right track!")
             $("thirdStep").html("");
          $('#thirdStep').append("<h1> More choices </h1>" + 
              sTart2 + obj[1].belong4a + cLose + obj[1].belong4 + cSpan +  " " +
              sTart3 + obj[1].belong5a + cLose + obj[1].belong5 + cSpan +   " " +
              sTart4 + obj[1].belong6a + cLose + obj[1].belong6 + cSpan + " <br><br>" +
              sTart + obj[1].belong7a + cLose + obj[1].belong7 + cSpan +  " " +
              sTart2 + obj[1].belong8a + cLose + obj[1].belong8 + cSpan) 
           }
          else { alert ("That is not quite right")}
            
    //start the clicks
             $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#5a').click(function () {
            if (obj[1].belong5 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    //
     $('#6a').click(function () {
            if (obj[1].belong6 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
     //
      $('#7a').click(function () {
            if (obj[1].belong7 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
      //
       $('#8a').click(function () {
            if (obj[1].belong8 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    
    //
      });
    
    
    
      });
        });
    
    
    
    $(document).ready(function () {  
            $('#4a').click(function () {
            if (obj[1].belong4 == obj[1].belong9) {
          alert ("You have earned a gold star, that was correct!")}
          else {
            alert ("I think some additional training maybe required, please try again and may the odds ever be in your favor.")
        }
        });
    });
                
    
    
    var obj = [{
        "fruit": "B",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 1,
        "belong1": "A-M",//choice
        "belong2": "N-Z",//choice
        "belong3": "A-M",//answer
        "belong4": "The letter is closer to A than M",//choice2
        "belong5": "The letter is closer to M than A",//choice2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//choice2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//choice2
        "belong9": "The letter is closer to A than M",//answer2
        "belong4a": "4a",
        "belong5a": "5a",
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoAthanM"//spanid answer
    
    
    
      },
         {
        "fruit": "n",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 2,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",//c2
        "belong5": "The letter is closer to M than A",//c2
        "belong6": "The letter is N",//choice2
        "belong7": "The letter is closer to Z than N",//c2
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",//c2
        "belong9": "The letter is N",//answer 2
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisN"
      },
      {
        "fruit": "x",
        "absolute": "YES",
        "exclamationEqual":"NO",
        "position": 3,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "N-Z",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "TheletterisclosertoZthanN"
    
      },
        {
        "fruit": 1,
        "absolute": "NO",
        "exclamationEqual":"YES",
        "position": 4,
        "belong1": "A-M",
        "belong2": "N-Z",
        "belong3": "Supercalifragilisticexpialadocious",
        "belong4": "The letter is closer to A than M",
        "belong5": "The letter is closer to M than A",
        "belong6": "The letter is N",
        "belong7": "The letter is closer to Z than N",
        "belong8": "I needed an example of another option, but you should not chose me because I am wrong",
        "belong9": "If you got this to come up, you definitely cheated...",
        "belong9": "The letter is closer to Z than N",
        "belong4a": "4a",//sc2
        "belong5a": "5a",//sc2
        "belong6a": "6a",
        "belong7a": "7a",
        "belong8a": "8a",
        "belong9a": "Ifyougotthistocomeup,youdefinitelycheated"
      }
        ]
    ;
    
    obj.sort(function (a, b) {return Math.random() - 0.5;});
    
    var a = [{
        "fruit": 1,
        "fruitname" : "The letter is closer to A than M",
        "append":"append"
      },
         {
        "fruit": 2,
        "fruitname" : "The letter is closer to M than A",
        "append":"append"
      },
      {
        "fruit": 3,
        "fruitname" : "The letter is N",
        "append":"append"
      },
      {
        "fruit": 4,
        "fruitname" : "The letter is closer to Z than N",
        "append":"append"
      },
      {
        "fruit": 5,
        "fruitname" : "I needed an example of another option, but you should not chose me because I am wrong",
        "append":"append"
      }
     
        ];
    
    a.sort(function (a, b) {return Math.random() - 0.5;});
    #append1 { margin-right: 3px; }
    #append2 { margin-right: 3px; }
    #append3 { margin-right: 3px; }
    #append4 { margin-right: 3px; }
    #append5 { margin-right: 3px; }