jsが書いた体彩サッカー予測分析

89588 ワード

最近ルームメイトがワールドカップの予測をしているので、ついでに分析を書きます.次はコードを直接与えて、とても简単で、コピーコードは直接htmlファイルに保存すればいいです.mq0036
説明:Jqueryを探して現在のページに引用すればいいです.
<html>
<head>

<script src="jquery-1.4.2.min.js"></script>

<script>

function js()
{
    //$("tr").children("td")[3].css("background-color","red");
    //$("#td1").css("background-color","#516831");
    
    var a=b=c=0;
    
    a=$("#z").val();
    b=$("#k").val();
    c=$("#r").val();
    
    $("#rqs").html(c);
    
    if(a>b)setcolor("td1");
    if(a==b)setcolor("td2");
    if(a<b)setcolor("td3");
    
    if(a+c>b)setcolor("rtd1");
    if(a+c==b)setcolor("rtd2");
    if(a+c<b)setcolor("rtd3");
}


function setcolor(id){
    $("#"+id).css("background-color","#516831");
}

$("#b1").hide();

function zh(){
    var str="",str2="";
    var a1=0,a2=0,b1=0,b2=0,c=0;
    
    a1=$("#z1").val();
    a2=$("#z2").val();
    b1=$("#k1").val();
    b2=$("#k2").val();
    c=$("#r").val();
    
    $("#chk").html("");
    $("#chk").append(' <input type=checkbox value=s checked=checked onclick="chk()" />  <input checked=checked type=checkbox value=f onclick="chk()"/>  <input checked=checked type=checkbox value=p onclick="chk()" />');
    $("#chk").append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
    $("#chk").append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
    $("#chk").append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
    $("#chk").append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");

    var spf;
    for(i=a1;i<=a2;i++){
        for(j=b1;j<=b2;j++){
            
            if((1*i)>j)spf="s";
            if((1*i)==j)spf="p";
            if((1*i)<j)spf="f";
            
            str += "<tr class='"+spf+"'><td>"+i+"&nbsp;</td><td>"+j+"&nbsp;</td>";
            if(i>j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";}
            if(i==j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";}
            if(i<j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";}
            str += "<td>&nbsp;"+c+"</td>";
            
            //alert("i="+i+" j="+j+","+(1*i+c*1)+"
(i+c)>j :" +((i+c)>j));
if((1*i+c*1)>j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";} if((1*i+c*1)==j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";} if((1*i+c*1)<j){str += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str += "<td>&nbsp;</td>";} str+="</tr>"; str2 += "<tr id='1_"+i+j+"' class='"+spf+"2'><td rowspan='2'>"+i+"&nbsp;</td><td rowspan='2'>"+j+"&nbsp;</td><td>0</td>"; if(i>j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} if(i==j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} if(i<j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} str2 += "</tr><tr id='2_"+i+j+"' class='"+spf+"2'>"; str2 += "<td>&nbsp;"+c+"</td>"; if((1*i+c*1)>j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} if((1*i+c*1)==j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} if((1*i+c*1)<j){str2 += "<td style='background-color:#516831;'>&nbsp;</td>"}else{str2 += "<td>&nbsp;</td>";} str2+="</tr>"; $("#chk").append(i+":"+j+"<input id="+i+j+" type=checkbox i="+i+" j="+j+" checked onclick='chk()' /> &nbsp;"); } } $("#pp1").html(""); $("#pp2").html(""); $("#pp1").append(str); $("#pp2").append(str2); $('input[type="checkbox"]:checked').each( function() { $(this).attr("checked","true"); } ); } function chk() { $(".s").hide(); $(".p").hide(); $(".f").hide(); $(".s2").hide(); $(".p2").hide(); $(".f2").hide(); //$("#s3").hide(); //$("#p3").hide(); //$("#f3").hide(); //$(".sh").hide(); $('input[type="checkbox"]:checked').each( function() { $("."+$(this).val()).show(); //alert($(this).attr("i")+$(this).attr("i")); //alert($(this).attr("id")); //$("."+$(this).val()+"2").show(); $("#1_"+$(this).attr("i")+$(this).attr("j")).show(); $("#2_"+$(this).attr("i")+$(this).attr("j")).show(); } ); } </script> </head> <body><input id='z' type=text /><input id='k' type=text /><input id='r' type=text value="-1" /> <button id='b1' style="display:none" onclick="js();"> </button> <br /><input id='z1' type=text style="width:40px" value="0" /> <input id='z2' value="2" type=text style="width:40px" >&nbsp;&nbsp;<input id='k1' type=text style="width:40px" value="0"/> <input id='k2' value="2" type=text style="width:40px" > <button id='b1' onclick="zh();"> </button> <button id='b1' onclick="alert($('#sc').html());"> </button> <br /><br /> <div id='chk'> <input type=checkbox value=s onclick="chk()" /> <input type=checkbox value=f onclick="chk()"/> <input type=checkbox value=p onclick="chk()" /> </div> <br /> <table id='tab'> <tr> <th class="fs16 br0" colspan="2"> </th> <th class="fs16 br0" colspan="3"> </th> <th class="fs16" colspan="4"> </th> </tr> <tr> <th class="t1 bt0"> </th> <th class="t1 br0 bt0"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br0 bt0"> </th> <th class="t3 br1 bt0 concede"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br0 bt0"> </th> </tr> <tbody id="pp1"> <tr> <td> </td> <td> </td> <td id=td1>&nbsp;</td> <td id=td2>&nbsp;</td> <td id=td3>&nbsp;</td> <td id=rqs>&nbsp;</td> <td id=rtd1>&nbsp;</td> <td id=rtd2>&nbsp;</td> <td id=rtd3>&nbsp;</td> </tr> </tbody> </table> <br /><br /> <table id='tab2' style="width:300px;left:450px;"> <tr> <th class="fs16 br0" colspan="2"> </th> <th class="fs16" colspan="4"> </th> </tr> <tr> <th class="t1 bt0"> </th> <th class="t1 br0"> </th> <th class="t3 br1 bt0 concede"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br1 bt0"> </th> <th class="t3 br0 bt0"> </th> </tr> <tbody id="pp2"> <tr class=sh> <td rowspan="2"> </td> <td rowspan="2"> </td> <td id=td1>&nbsp;</td> <td id=td2>&nbsp;</td> <td id=td3>&nbsp;</td> <td id=td3>&nbsp;</td> </tr> <tr class=sh> <td id=rqs>&nbsp;</td> <td id=rtd1>&nbsp;</td> <td id=rtd2>&nbsp;</td> <td id=rtd3>&nbsp;</td> </tr> </tbody> </table> </body> </html> <style> table { border-width:1px; border-color:#f00; border-style:solid; text-align:center; font-Size:12px; width:400px; position: absolute; top:110px; } th{ border-width:thin; border-color:#f00; border-style:solid; height:25px; } td { border-width:1px; border-color:#f00; border-style:solid; text-align:center; font-Size:12px; } </style>