基本上我試圖讓生成的隨機號碼在點擊一個按鈕後變成另一個隨機號碼。我也無法弄清楚如何取消選擇所選表單我試着如何使用jQuery下面。JavaScript/JQuery變量需要更改..點擊。刪除舊號碼添加新號碼
var randomNum1 = Math.ceil(Math.random(20)*10000);
var randomNum2 = Math.ceil(Math.random(20)*10000);
var randomNum3 = Math.ceil(Math.random(20)*10000);
var randomNum4 = Math.ceil(Math.random(20)*10000);
$("#race-again").click(function()
{
$(".one").css({ marginLeft: "0" });
$(".two").css({ marginLeft: "0" });
$(".three").css({ marginLeft: "0" });
$(".four").css({ marginLeft: "0" });
$("#slide2").animate({ marginTop: "0" }, { duration: 1000 });
$("#slide3").animate({ marginTop: "0" }, { duration: 1000 });
$("#slide4").animate({ marginTop: "0" }, { duration: 1000 });
$("#slide5").animate({ marginTop: "0" }, { duration: 1000 });
$("#betting-money").val("0");
$("#results").hide("");
$("#winner").hide("");
$("#next-end").hide("");
//trying to unselect the form input selection
$("#race input option:selected").attr("selected", "");
//new random number generated... which doesn't work
var randomNum1 = Math.ceil(Math.random(20)*10000);
var randomNum2 = Math.ceil(Math.random(20)*10000);
var randomNum3 = Math.ceil(Math.random(20)*10000);
var randomNum4 = Math.ceil(Math.random(20)*10000);
});