说来好笑,自己怎么会抽一个小时做这么一个小程序,可能我是太喜欢买彩票但是老中不了的缘故吧。不过老实说这个程序也帮不了你中双色球,娱乐而已。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> <HTML> <HEAD><TITLE> doubleColorBoom </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Author" CONTENT="三年计划"><META NAME="Keywords" CONTENT="双色球"><META NAME="Description" CONTENT="双色球号概率预知程序"><script>var arrySix = new Array(),count = 0,redMap = new Map(),blueMap = new Map();/*** 计算红球*/function startClu6() {var number = Math.ceil(Math.random() * 33);var isexist = false;for (var k = 0; k < arrySix.length; k++) {if (number == arrySix[k]) {isexist = true;}}if (!isexist)arrySix.push(number);if (arrySix.length < 6)startClu6(); else {arrySix = arrySix.sort();cluLastOne();}}/*** 计算蓝球*/function cluLastOne() {arrySix.push(Math.ceil(Math.random() * 16));}/*** 计算每一次的结果信息*/var flagindex = 0;function cluResult() {count++;startClu6();for (var i = 0; i < 7; i++) {for (var k = 1; k < 36; k++) {if (i < 6 && arrySix[i] == k) {if (!redMap.containsKey(k)) {redMap.put(k, 1);} else {var oldvalue = redMap.get(k);redMap.remove(k);redMap.put(k, oldvalue + 1);}}}for (var j = 1; j <= 16; j++) {if (i == 6 && arrySix[i] == j) {if (!blueMap.containsKey(j)) {blueMap.put(j, 1);} else {var oldvalue = blueMap.get(j);blueMap.remove(j);blueMap.put(j, oldvalue + 1);}}}document.getElementById("one_" + (i + 1)).value = arrySix[i];if (document.getElementById("one1_" + (i + 1)).value != null && document.getElementById("one1_" + (i + 1)).value != "") {if (arrySix[i] == document.getElementById("one1_" + (i + 1)).value) {flagindex++;document.getElementById("one1_8").value = flagindex;}}}document.getElementById("one_8").value = "当前计算次数为" + count;arrySix.length = 0;if (flagindex != 7) {flagindex = 0;} else {endClu();alert("已经完全匹配预测号码!");}}/*** 结果排序方法自定义*/Array.prototype.sort = function(type) {if (type == "desc") {for (var i = 0; i < this.length - 1; i++) {for (var k = i + 1; k < this.length; k++) {if (this[i] < this[k]) {var temp = this[i];this[i] = this[k];this[k] = temp;}}}} else {for (var i = 0; i < this.length - 1; i++) {for (var k = i + 1; k < this.length; k++) {if (this[i] > this[k]) {var temp = this[k];this[k] = this[i];this[i] = temp;}}}}return this;}/*** 开始计算*/var Interval_control = null;function startClu() {if (flagindex != 6) {Interval_control = setInterval("cluResult()", 100);} else {endClu();alert("已经完全匹配预测号码!");}}/*** 终止计算*/function endClu() {if (Interval_control != null) {clearInterval(Interval_control);} else alert("没有开始计算无需结束!");Interval_control = null;}/*** 显示计算结果信息*/function showAllInfo() {if (Interval_control == null) {var redInfoMsg = "";var blueInfoMsg = "";var tjhqh = "",tjhqhtempvalue = 0;var tjhm = document.getElementById("tjhm");if (redMap.size() != 0) {for (var i = 1; i < 34; i++) {if (redMap.containsKey(i)) {redInfoMsg += (i + "号红球出现的次数为:" + redMap.get(i) + "<br>");} else redInfoMsg += (i + "号红球出现的次数为:" + 0 + "<br>");}for (var k = 1; k <= 16; k++) {if (blueMap.containsKey(k)) {if (blueMap.get(k) > tjhqhtempvalue) {tjhqhtempvalue = blueMap.get(k);tjhqh = k;}blueInfoMsg += (k + "号蓝球出现的次数为:" + blueMap.get(k) + "<br>");} else blueInfoMsg += (k + "号蓝球出现的次数为:" + 0 + "<br>");}document.getElementById("redInfo").innerHTML = redInfoMsg;document.getElementById("blueInfo").innerHTML = blueInfoMsg;var redDivHtml = "";var redBoomArray = redMap.values();redBoomArray = redBoomArray.sort("desc");redBoomArray = redBoomArray.slice(0, 7);redBoomArray = redBoomArray.reverse();for (var j = 0; j < 6; j++) {for (var w = 1; w < 34; w++) {if (redBoomArray[j] == redMap.get(w) && redDivHtml.indexOf(w + "</font>号") == -1) {redDivHtml += ("<font color=red>" + w + "</font>号(" + redBoomArray[j] + ")次 ");break;}}}redDivHtml += (" <font color=blue>" + tjhqh + "</font>号蓝球(" + tjhqhtempvalue + "次)");tjhm.innerHTML = redDivHtml;redInfoMsg = "";blueInfoMsg = "";} else {alert("当前没有任何计算结果信息!");}arrySix.length == 0;count = 0;redMap.clear();blueMap.clear();} else {alert("请先停止计算!");}}/** MAP对象,实现MAP功能** 接口:* size() 获取MAP元素个数* isEmpty() 判断MAP是否为空* clear() 删除MAP所有元素* put(key, value) 向MAP中增加元素(key, value)* remove(key) 删除指定KEY的元素,成功返回True,失败返回False* get(key) 获取指定KEY的元素值VALUE,失败返回NULL* element(index) 获取指定索引的元素(使用element.key,element.value获取KEY和VALUE),失败返回NULL* containsKey(key) 判断MAP中是否含有指定KEY的元素* containsValue(value) 判断MAP中是否含有指定VALUE的元素* values() 获取MAP中所有VALUE的数组(ARRAY)* keys() 获取MAP中所有KEY的数组(ARRAY)** 例子:* var map = new Map();** map.put("key", "value");* var val = map.get("key")* ……**/function Map() {this.elements = new Array();//获取MAP元素个数this.size = function() {return this.elements.length;}//判断MAP是否为空this.isEmpty = function() {return (this.elements.length < 1);}//删除MAP所有元素this.clear = function() {this.elements = new Array();}//向MAP中增加元素(key, value)this.put = function(_key, _value) {this.elements.push({key : _key,value : _value});}//删除指定KEY的元素,成功返回True,失败返回Falsethis.remove = function(_key) {var bln = false;try {for (i = 0; i < this.elements.length; i++) {if (this.elements[i].key == _key) {this.elements.splice(i, 1);return true;}}} catch (e) {bln = false;}return bln;}//获取指定KEY的元素值VALUE,失败返回NULLthis.get = function(_key) {try {for (i = 0; i < this.elements.length; i++) {if (this.elements[i].key == _key) {return this.elements[i].value;}}} catch (e) {return null;}}//获取指定索引的元素(使用element.key,element.value获取KEY和VALUE),失败返回NULLthis.element = function(_index) {if (_index < 0 || _index >= this.elements.length) {return null;}return this.elements[_index];}//判断MAP中是否含有指定KEY的元素this.containsKey = function(_key) {var bln = false;try {for (i = 0; i < this.elements.length; i++) {if (this.elements[i].key == _key) {bln = true;}}} catch (e) {bln = false;}return bln;}//判断MAP中是否含有指定VALUE的元素this.containsValue = function(_value) {var bln = false;try {for (i = 0; i < this.elements.length; i++) {if (this.elements[i].value == _value) {bln = true;}}} catch (e) {bln = false;}return bln;}//获取MAP中所有VALUE的数组(ARRAY)this.values = function() {var arr = new Array();for (i = 0; i < this.elements.length; i++) {arr.push(this.elements[i].value);}return arr;}//获取MAP中所有KEY的数组(ARRAY)this.keys = function() {var arr = new Array();for (i = 0; i < this.elements.length; i++) {arr.push(this.elements[i].key);}return arr;}}</script> </HEAD><BODY> 预测号码:<br> <input type="text" style="width:50px;" id=one1_1 value=""> <input type="text" style="width:50px;" id=one1_2 value=""> <input type="text" style="width:50px;" id=one1_3 value=""> <input type="text" style="width:50px;" id=one1_4 value=""> <input type="text" style="width:50px;" id=one1_5 value=""> <input type="text" style="width:50px;" id=one1_6 value=""> <input type="text" style="width:50px;" id=one1_7 value=""> <input type="text" style="width:250px;" id=one1_8 value=""> <br> <br> 计算号码:<br> <input type="text" style="width:50px;" id=one_1 value=""> <input type="text" style="width:50px;" id=one_2 value=""> <input type="text" style="width:50px;" id=one_3 value=""> <input type="text" style="width:50px;" id=one_4 value=""> <input type="text" style="width:50px;" id=one_5 value=""> <input type="text" style="width:50px;" id=one_6 value=""> <input type="text" style="width:50px;" id=one_7 value=""> <input type="text" style="width:250px;" id=one_8 value=""> <br><button οnclick="startClu();">开始计算</button> <button οnclick="endClu();">停止计算</button> <button οnclick="showAllInfo();">显示计算结果</button><table width="60%" align="center" border=1><thead><th width="50%" align="center" id="h">红球信息</th><th width="50%" align="center" id="l">蓝球信息</th></thead><tr><td width="50%" align="left" id="redInfo"></td><td width="50%" align="left" id="blueInfo"></td></tr><tr><td colspan=2 align="center">推荐号码:<div style="display:inline;" id="tjhm"></div></td></tr> </table> </BODY> </HTML>