Why doesn't IF logic work? please take a look at this JS code for me.

after doing it all day, I really don"t know what the problem is. This is a psychological test. Although the answer options range from agreeing to disagreeing, the score is different. One is 1-5 and the other is 5-1, but this function can not be realized. It is very strange that there is no problem in judging the logic, and there is no problem in executing the statement. I have tried N times but can not directly execute the statements behind ELSE, resulting in the key code that all the answer options score is the same. I have already framed it out, and now I agree very much to disagree with (1-5) points, and some of them cannot be realized if they need 5-1 points. Please help me to see where the problem comes from when I first encountered such an evil problem

Code post


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=yes" />

    <title></title>
    <link href="bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="style.css" />
    <link href="jquery.mmenu.all.css" rel="stylesheet" />
    <style type="text/css">
        body {
            background: -sharpa5a5a5;
            background-size: 100% auto !important
        }

        body .avatar .img-circle {
            background: -sharp347433 !important
        }

        body form .btn {
            background: -sharp347433 !important;
            border-color: -sharp347433 !important
        }

        -sharpheader h1,
        -sharpheader p {
            background: none !important
        }
    </style>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="bootstrap.min.js"></script>
    <script type="text/javascript" src="jquery.hammer.min.js"></script>
    <script type="text/javascript" src="jquery.mmenu.min.all.js"></script>
    <script src="wxm-core.js"></script>

</head>

<body id="test1" class="test1">
    <div id="content">
        <div id="header_bar">
        </div>
        <!-- E header_bar -->


        <div class="container">
            <div id="header" class="text-center">
                <div style="height: 65px;"></div>

                <div class="container">
                    <div class="text-center header">
                        <h1 class="bold">
                            </h1>
                        

</div> <!-- E header --> <div id="bd" class="panel"> <div id="panel1" class="panel-body"> <form action="-sharp"> <div class="form-group avatar text-center"> <label for="" class="sr-only"></label> <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;text-align: center; width: 100%; padding-top: 18px;"> <img src="ks.jpg"></span> </a> </div> <dl> <dd> </dd> </dl> <div class="buttons"> <a href="-sharpresult" class="btn btn-lg btn-success" style="width: 100%" onclick="return next(0);"> <strong style="color:-sharpfdfd88;"></strong></a> </div> <div class="buttons" style="margin-top: 10px;"> <a href="" id="weixinfollowlink2" class="btn btn-lg btn-danger" style="width: 100%;"></strong></a> </div> </form> </div> <!-- --> <!-- E panel-body --> <div id="panel2" class="panel-body js_answer" style="display: none;"> <form action="-sharp" method="POST"> <a name="result" href="javascript:void(0)"></a> <div class="form-group avatar text-center"> <label for="" class="sr-only"> </label> <a href="javascript:void(0)" class="img-circle" name="1" style="position:relative"><span id="resultscore" style="float: left; text-align: center; width: 100%; padding-top: 0px;"></span> </a> </div> <dl> <dd></dd> </dl> <ul class="list-group js_group"> <li class="list-group-item" onclick="return toggle(this);"> <input name="g" type="radio" value="" /> <span class="QAns"></span></li> <li class="list-group-item" onclick="return toggle(this);"> <input name="g" type="radio" value="" /> <span class="QAns"></span></li> <li class="list-group-item" onclick="return toggle(this);"> <input name="g" type="radio" value="" /> <span class="QAns"></span></li> <li class="list-group-item" onclick="return toggle(this);"> <input name="g" type="radio" value="" /> <span class="QAns"></span></li> <li class="list-group-item" onclick="return toggle(this);"> <input name="g" type="radio" value="" /> <span class="QAns"></span></li> </ul> </form> </div> <div id="panel3" class="panel-body js_result" data-id="0" style="display: none;"> <h1 class="bold text-danger"> 0~52</h1> <hr> <dl> <dt>:</dt> <dd>

10 ) ?

</dd> </dl> <div class="buttons"> <a href="javascript:void(0)" class="btn btn-lg btn-success" style="width: 100%" onclick="$("-sharpmcover").show()"> </a> </div> </div> <div id="panel3" class="panel-body js_result" data-id="1" style="display: none;"> <h1 class="bold text-danger"> 53~105</h1> <hr> <dl> <dt>:</dt> <dd>

</dd> </dl> <div class="buttons"> <a href="javascript:void(0)" class="btn btn-lg btn-success" style="width: 100%" onclick="$("-sharpmcover").show()"> </a> </div> </div> <div id="panel3" class="panel-body js_result" data-id="1" style="display: none;"> <h1 class="bold text-danger"> 106~210</h1> <hr> <dl> <dt>:</dt> <dd>

</dd> </dl> <div class="buttons"> <a href="javascript:void(0)" class="btn btn-lg btn-success" style="width: 100%" onclick="$("-sharpmcover").show()"> </a> </div> </div> </div> <!-- E container --> <input type="hidden" name="totalsc" id="totalsc" value="0" /> <script type="text/javascript"> var total = 42; var scoreArr = new Array(); scoreArr[0] = new Array(); scoreArr[0]["min"] = 0; scoreArr[0]["max"] = 52; scoreArr[1] = new Array(); scoreArr[1]["min"] = 53; scoreArr[1]["max"] = 105; scoreArr[2] = new Array(); scoreArr[2]["min"] = 106; scoreArr[2]["max"] = 210; var tScore = 0; // var QArr = new Array(parseInt(total)); // QArr[0] = "1."; QArr[1] = "2."; QArr[2] = "3."; QArr[3] = "4."; QArr[4] = "5."; QArr[5] = "6."; QArr[6] = "7."; QArr[7] = "8."; QArr[8] = "9."; QArr[9] = "10."; QArr[10] = "11."; QArr[11] = "12."; QArr[12] = "13."; QArr[13] = "14."; QArr[14] = "15."; QArr[15] = "16."; QArr[16] = "17."; QArr[17] = "18."; QArr[18] = "19."; QArr[19] = "20."; QArr[20] = "21."; QArr[21] = "22."; QArr[22] = "23."; QArr[23] = "24."; QArr[24] = "25."; QArr[25] = "26."; QArr[26] = "27."; QArr[27] = "28."; QArr[28] = "29."; QArr[29] = "30."; QArr[30] = "31."; QArr[31] = "32."; QArr[32] = "33."; QArr[33] = "34."; QArr[34] = "35."; QArr[35] = "36."; QArr[36] = "37."; QArr[37] = "38."; QArr[38] = "39."; QArr[39] = "40."; QArr[40] = "41."; QArr[41] = "42."; // var QAnn = 5; var QAns = new Array(QAnn); QAns[0] = "A."; QAns[1] = "B."; QAns[2] = "C."; QAns[3] = "D."; QAns[4] = "E."; // var QAnon = 2; // var QAno = new Array(); QAno[0] = [1, 2, 3, 4, 5]; QAno[1] = [5, 4, 3, 2, 1]; // //[] var referSn = new Array(); referSn = [4, 15, 25, 26, 31, 39]; var QAnor = false; for (var i = 0; i < QArr.length; iPP) { // if (i <= QArr.length - 1) { $("-sharppanel2").after($("-sharppanel2").clone()); } // if (referSn.indexOf(i + 1) != -1) { QAnor = true; } else { QAnor = false; } ** > // > if (QAnor == true) { > > for (var j = 0; j < QAno[0].length; jPP) { > $("div.js_answer").eq(i).find("input[name="g"]").eq(j).val(QAno[0][j]); > } > } else { > > for (var j = 0; j < QAno[1].length; jPP) { > $("div.js_answer").eq(i).find("input[name="g"]").eq(j).val(QAno[1][j]); > } > } ** } function next(t, score) { // console.log(t); $("div-sharpbd > div.panel-body").hide(); $("div.js_answer").eq(t).show(); // var cEle = $( "<span id = \"upscore\" style=\"color:white; font-size:15px;position:absolute;left:90%;top:0px;\">+" + score + "</span>"); // console.log(cEle); $("div.js_answer").eq(t).find("-sharpresultscore").after(cEle); $("div.js_answer").stop().eq(t).find("-sharpupscore").animate({ top: "-100px", opacity: "0" }, 1500); $("div.js_answer").eq(t).find("-sharpresultscore").html($("-sharptotalsc").val()); // $("div.js_answer").eq(t).find("dd").html(QArr[t]); // for (var i = 0; i < QAns.length; iPP) { $("div.js_answer").eq(t).find(".QAns").eq(i).text(QAns[i]); } gotoTop(); } function result(t) { // share_pop("open", 10000); $("div-sharpbd > div.panel-body").hide(); for (var i = 0; i < parseInt(scoreArr.length); iPP) { if (parseInt(t) >= parseInt(scoreArr[i]["min"]) && parseInt(t) <= parseInt( scoreArr[i][ "max" ])) { $("div.js_result").eq(i).show(); // $("div.js_result").eq(i).find(".resultscore").eq(0).html($("-sharptotalsc").val()); gotoTop(); } else continue; } } //, ,, var jieliu = true; function toggle(t) { if (jieliu) { jieliu = false; $(t).children("input").attr("checked", "checked"); $("li.list-group-item").removeClass("active"); var score = $(t).children("input:checked").val(); tScore = parseInt(tScore) + parseInt(score); $("-sharptotalsc").val(tScore); $(t).addClass("active"); var t = $("div.js_answer").index($(t).parents("div.js_answer")) + 1; // console.log(t); if (t >= total) { result(tScore); } else { setTimeout(function () { next(t, score); }, 300); } // setTimeout(function () { jieliu = true; }, 500); } } function gotoTop() { $("body,html").animate({ scrollTop: ($("-sharpheader").offset().top + $("-sharpheader").height()) }, 0); } </script> </div> <!-- --> <script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script> <script> /* * : * 1. JS"" "" "JS" * 2. Android Android 6.0.2.58 * 3. JS-SDK :http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html * * "5-" : * :weixin-open@qq.com * :JS-SDK * : */ wx.config({ debug: false, appId: "<?php echo $signPackage["appId"]; ?>", timestamp: <?php echo $signPackage["timestamp"]; ?>, nonceStr: "<?php echo $signPackage["nonceStr"]; ?>", signature: "<?php echo $signPackage["signature"]; ?>", jsApiList: ["checkJsApi", "onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareQQ", "onMenuShareWeibo", "showOptionMenu", "hideMenuItems", "onMenuShareQZone" ] }); wx.ready(function () { // // wx.onMenuShareTimeline({ title: "", link: "http://www.tingxinyuan.com/ts/index.php", desc: "", // imgUrl: "https://img.codeshelper.com/upload/img/2021/09/26/12qyts0k43v339.jpg", // success: function () { shareSuccess(); } }); // wx.onMenuShareAppMessage({ title: "", link: "http://www.tingxinyuan.com/ts/index.php", desc: "", // imgUrl: "https://img.codeshelper.com/upload/img/2021/09/26/12qyts0k43v339.jpg", // success: function () { shareSuccess(); } }); }); </script> <script type="text/javascript"> // $(function () { $("input[name="g"]").change(function () { $("li.list-group-item").removeClass("active") $(this).parent("li.list-group-item").addClass("active"); }); }); </script> <!-- --> <div id="mcover" onclick="document.getElementById("mcover").style.display="";" style="display: none;"><img src="guide.png"></div> <div id="pop_success" class="text-center" style="display: none;"> <div class="bd text-center"> <p style="line-height: 110px;">

</div> <!-- E bd --> </div> <!-- E pop_success --> <div id="popup-1" class="tip" style="display: none;"> <div> <a id="close1" href="javascript:void(0)"><i class="glyphicon glyphicon-remove"></i> </a> <div class="row text-center"> <a href="javascript:;" class="btn btn-danger col-sm-12 btn-lg" id="weixinfollowlink">:</a> </div> <!-- E discuss --> </div> </div> <!-- E tip --> <div id="follow" class="well" style="display: none;"> <a id="close1" href="javascript:void(0)">X</a> <div class="row text-center"> <a href="javascript:;" class="btn btn-danger col-sm-12 btn-lg" id="weixinfollowlink1">:</a> </div> <!-- E row --> </div> <script> $(function () { $("a-sharpclose1").click(function () { share_pop("close", 0); }); if (navigator.userAgent.indexOf("MicroMessenger")) { $("-sharpweixinfollowlink").attr("href", "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI0NzQyNDY2Nw==&scene=126-sharpwechat_redirect" ); $("-sharpweixinfollowlink1").attr("href", "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI0NzQyNDY2Nw==&scene=126-sharpwechat_redirect" ); $("-sharpweixinfollowlink2").attr("href", "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI0NzQyNDY2Nw==&scene=126-sharpwechat_redirect" ); } }); function shareSuccess() { $("div-sharppop_success").show().delay(1500).fadeOut("slow"); } </script> <div id="copy"> <p class="text-center"> <a href="http://tingxinyuan.com" target="_blank"></a>

</div> <!-- E copy --> <div id="share_tips" class="sr-only"> <div class="container text-right"> / <i class="glyphicon glyphicon-hand-up element-animation"></i> </div> <!-- E container --> </div> </body> </html>

you can also directly access the address of my station http://www.tingxinyuan.com/ts/

.

problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Sep.26,2021

the key problem lies in this sentence.

  

is really a great god. Thank you very much. I'm also worried that the code is complicated and not described clearly. I didn't expect you to find out the logic problem directly. Thanks again

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bc87-4ef26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bc87-4ef26.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?