<script type="text/javascript">
<!--
a=50; // 今の数
b=Math.ceil(Math.random() * 100); // 比べる数
count=1; // 何問目か数えてます
function lors(){
if(confirm("第"+count+"問目\n次の数は "+a+" より大きい?")){
if(a<b){
a=b;
b=Math.ceil(Math.random() * 100);
count=count+1;
lors();}
else{count=count-1;
alert(""+b+"\n残念。またチャレンジしてね。\n(連続正解記録"+count+"問)")
count=1;
a=50;
b=Math.ceil(Math.random() * 100);
}}
else{
if(a>b){
a=b;
b=Math.ceil(Math.random() * 100);
count=count+1;
lors();}
else{count=count-1;
alert(""+b+"\n残念。またチャレンジしてね。\n(連続正解記録"+count+"問)")
count=1;
a=50;
b=Math.ceil(Math.random() * 100);
}
}
}
//-->
</script>
|