如何提取在线网页中的软件?
比如这个网页中的彩票计算器http://web.
/* * 方法:Array.remove(dx) * 功能:删除数组元素. * 参数:dx删除元素的下标. * 返回:在原数组上修改数组 */ //经常用的是通过遍历,重构数组. Array.prototype.remove=function(dx) { if(isNaN(dx)||dx>this.length){return false;} for(var i=0,n=0;i<this.length;i++) { if(this[i]!=this[dx]) { this[n++]=this[i] } } this.length-=1 } /* * 方法:Array.baoremove(dx) * 功能:删除数组元素. * 参数:dx删除元素的下标. * 返回:在原数组上修改数组. */ //我们也可以用splice来实现. Array.prototype.baoremove = function(dx) { if(isNaN(dx)||dx>this.length){return false;} this.splice(dx,1); } /* * 方法: Array.append(ary) * 功能: 添加数组元素. * 参数:ary 要添加到数组的的 数组. * 返回:在原数组上修改数组. */ Array.prototype.append = function(ary){ for(var i=0;i<ary.length;i++){ this.push(ary[i]); ary.remove(i); i=-1; } } //判断oName是否被选中 功能: 全选 function checkAll(oName){ var o = document.all(oName); for(var i=0;i<o.length;i++){ if(o[i].checked == false){ o[i].checked=true; } } } //3D尾号详情 function d3_whxq_load(){ var tbl= document.getElementById("tbl1"); for(var j=0;j<50;j++){ var i; var newRow = tbl.insertRow(); newRow.align="center"; var cla002=QCODEn[j]; var cla004 = CLA004n[cla002]; var cell=newRow.insertCell(0); cell.bgColor="#efefef"; cell.innerText=cla002; for(i=0;i<10;i++){ cell = newRow.insertCell(i+1); if(cla004.indexOf(i) != -1){ cell.bgColor="#9CDEFE"; cell.innerText=i; }else{ cell.bgColor="#ffffff"; } } cell = newRow.insertCell(11); cell.bgColor="#ffffff"; cell.innerText=cla004; } } //3D组选计算器 //var result = new Array(); function fire(){ var numList=new Array(); var hezhiNum=new Array(); var kdNumList=new Array(); var lyeNumList=new Array(); var dzxNumList=new Array(); var joNumList=new Array(); init(numList,hezhiNum,kdNumList,lyeNumList,dzxNumList,joNumList); var res_d3=new Array(); var res_d6=new Array(); var res_dd=new Array(); // 组三 if(document.getElementById("d3").checked==true){ getD3(numList,res_d3); checkDm(res_d3); checkedHezhi(res_d3,hezhiNum); checkKd(res_d3,kdNumList); checkLye(res_d3,lyeNumList); checkDzx(res_d3,dzxNumList); checkJo(res_d3,joNumList); } // 组六 if(document.getElementById("d6").checked==true){ var stack = new Array(); initStack(numList,stack); var buff = new Array(); getD6(stack,buff,res_d6); clearAry(stack); clearAry(buff); checkDm(res_d6); checkedHezhi(res_d6,hezhiNum); checkKd(res_d6,kdNumList); checkLye(res_d6,lyeNumList); checkDzx(res_d6,dzxNumList); checkJo(res_d6,joNumList); } // 豹子 if(document.getElementById("dd").checked==true){ getDd(numList,res_dd); checkDm(res_dd); checkedHezhi(res_dd,hezhiNum); checkKd(res_dd,kdNumList); checkLye(res_dd,lyeNumList); checkDzx(res_dd,dzxNumList); checkJo(res_dd,joNumList); } var result=res_d3.join(" ")+" "+res_d6.join(" ")+" "+res_dd.join(" "); var resultLen=res_d3.length+res_d6.length+res_dd.length; document.getElementById("Layer1").innerHTML=result+" <br>总共有 : "+resultLen+" 注!!!<br> 总金额为 : "+resultLen*2+" 元<BR><BR><BR><a href=http://www.浙江风采网</a>"; clearAry(res_d3); clearAry(res_d6); clearAry(res_dd); } // 直选计算器 function fire1(){ var gg=new Array(); var ss=new Array(); var bb=new Array(); var hezhiNum=new Array(); var kdNumList=new Array(); var lyeNumList=new Array(); var dzxNumList=new Array(); var joNumList=new Array(); if(hezhiNum.length < 21){ init1(gg,ss,bb,hezhiNum,kdNumList,lyeNumList,dzxNumList,joNumList); var res_d3=new Array(); var res_d6=new Array(); var res_dd=new Array(); var result=new Array(); getD31(gg,ss,bb,res_d3,res_d6,res_dd); if(document.getElementById("d3").checked==true){ if(hezhiNum.length>0){ checkedHezhi(res_d3,hezhiNum); } result.append(res_d3); } if(document.getElementById("d6").checked==true){ if(hezhiNum.length>0){ checkedHezhi(res_d6,hezhiNum); } result.append(res_d6); } if(document.getElementById("dd").checked==true){ if(hezhiNum.length>0){ checkedHezhi(res_dd,hezhiNum); } result.append(res_dd); } checkKd(result,kdNumList); checkLye(result,lyeNumList); checkDzx(result,dzxNumList); checkJo(result,joNumList); var resultLen=result.length; result.sort(); document.getElementById("Layer1").innerHTML=result.join(" ")+" <br>总共有 : "+resultLen+" 注!!! <br>总金额为 : "+resultLen*2+" 元<BR><BR><BR><a href=http://www.浙江风采网</a>"; clearAry(res_d3); clearAry(res_d6); clearAry(res_dd); }else{ alert("您选择的合值过多,这可能会影响计算速度!!!"); } } //直选的时候 选择的合值的个数 不能超过10个 function hezhiCount(oTagName,oName){ var numm = document.all(oTagName); var tag=0; for(var i=0;i<numm.length;i++){ if(numm[i].checked == true){ tag++; } if(tag > 20){ alert("您选择的合值过多,这可能会影响您的计算速度!!!"); oName.checked=false; break; } } } //初始化过滤的条件 fire1 中调用 function init1(gg,ss,bb,hezhiNum,kdNumList,lyeNumList,dzxNumList,joNumList){ var numm = document.all("gg"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ gg.push(numm[i].value); } } numm = document.all("ss"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ ss.push(numm[i].value); } } numm = document.all("bb"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ bb.push(numm[i].value); } } numm=document.all("hz"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ hezhiNum.push(numm[i].value); } } numm=document.all("kd"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ kdNumList.push(numm[i].value); } } numm=document.all("lye"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ lyeNumList.push(numm[i].value); } } numm=document.all("dzx"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ dzxNumList.push(numm[i].value); } } numm=document.all("jo"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ joNumList.push(numm[i].value); } } } //初始化组合排列 function initStack(numList,stack){ for(var i=0;i<numList.length;i++){ stack.push(numList[i]); } } //初始化过滤的条件 fire 中调用 function init(numList,hezhiNum,kdNumList,lyeNumList,dzxNumList,joNumList){ var numm = document.all("num"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ numList.push(numm[i].value); } } numm=document.all("hz"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ hezhiNum.push(numm[i].value); } } numm=document.all("kd"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ kdNumList.push(numm[i].value); } } numm=document.all("lye"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ lyeNumList.push(numm[i].value); } } numm=document.all("dzx"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ dzxNumList.push(numm[i].value); } } numm=document.all("jo"); for(var i=0;i<numm.length;i++){ if(numm[i].checked==true){ joNumList.push(numm[i].value); } } } //清除O function clearAry(o){ var len=o.length; for(var i=0;i<len;i++){ o.remove(0); } } //获得3D所有组选组合 function getD3(numList,res_d3){ var len=numList.length; for(var i=0;i<len;i++){ var tmp=numList[i]; for(var j=0;j<len;j++){ if(numList[j] != tmp){ res_d3.push(tmp+tmp+numList[j]); } } } } ////获得3D所有置选组合 function getD31(gg,ss,bb,res_d3,res_d6,res_dd){ var len_gg=gg.length; var len_ss=ss.length; var len_bb=bb.length; if(len_gg>0){ for(var i=0;i<len_gg;i++){ var tmp_gg=gg[i]; if(len_ss>0){ for(var j=0;j<len_ss;j++){ var tmp_ss=ss[j]; if(len_bb>0){ for(var n=0;n<len_bb;n++){ var tmp_bb=bb[n]; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } }else{ for(var n=0;n<10;n++){ var tmp_bb=n; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } } } }else{ for(var j=0;j<10;j++){ var tmp_ss=j; if(len_bb>0){ for(var n=0;n<len_bb;n++){ var tmp_bb=bb[n]; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } }else{ for(var n=0;n<10;n++){ var tmp_bb=n; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } } } } } }else{ for(var i=0;i<10;i++){ var tmp_gg=i; if(len_ss>0){ for(var j=0;j<len_ss;j++){ var tmp_ss=ss[j]; if(len_bb>0){ for(var n=0;n<len_bb;n++){ var tmp_bb=bb[n]; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } }else{ for(var n=0;n<10;n++){ var tmp_bb=n; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } } } }else{ for(var j=0;j<10;j++){ var tmp_ss=j; if(len_bb>0){ for(var n=0;n<len_bb;n++){ var tmp_bb=bb[n]; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } }else{ for(var n=0;n<10;n++){ var tmp_bb=n; if(tmp_gg != tmp_ss & tmp_gg != tmp_bb & tmp_ss != tmp_bb){ res_d6.push(tmp_gg+tmp_ss+tmp_bb); }else{ if(tmp_gg==tmp_ss & tmp_ss==tmp_bb){ res_dd.push(tmp_gg+tmp_ss+tmp_bb); }else{ res_d3.push(tmp_gg+tmp_ss+tmp_bb); } } } } } } } } } function getD6(stack,buff,res_d6){ if(stack.length + buff.length < 3) return; //字母不够了,不用再试 while(stack.length > 0) //字母还没用完 { buff.push(stack.shift()); //选取字母 if(buff.length < 3) //还没到5个字母 { getD6(stack.slice(0), buff.slice(0),res_d6); //继续选取 } else if(buff.length == 3) { res_d6.push(buff.join("")); //够数量了,输出 } buff.pop(); //丢弃用过的字母 } return ; } function getDd(numList,res_dd){ var len=numList.length; for(var i=0;i<len;i++){ res_dd.push(numList[i]+numList[i]+numList[i]); } } function checkedHezhi(res,hezhiNum){ if(hezhiNum.length>0){ for(var i=0;i<res.length;i++){ var tag=false; var tmp=res[i]; var num1=tmp.substring(0,1); var num2=tmp.substring(1,2); var num3=tmp.substring(2,3); var sum=eval(num1)+eval(num2)+eval(num3); for(var j=0;j<hezhiNum.length;j++){ if(sum==hezhiNum[j]){ tag=true; } } if(!tag){ res.remove(i); i=-1; } } } } function checkKd(res,kdNumList){ if(kdNumList.length>0){ for(var i=0;i<res.length;i++){ var tag=false; var tmp=res[i]; var num1=tmp.substring(0,1); var num2=tmp.substring(1,2); var num3=tmp.substring(2,3); var sum=eval(getMax(num1,num2,num3))-eval(getMin(num1,num2,num3)); if(sum<0){ sum=sum * -1; } for(var j=0;j<kdNumList.length;j++){ if(sum==kdNumList[j]){ tag=true; } } if(!tag){ res.remove(i); i=-1; } } } } function getMax(num1,num2,num3){ if(num1>num2){ if(num1>num3){ return num1; }else{ return num3; } }else{ if(num2>num3){ return num2; }else{ return num3; } } } function getMin(num1,num2,num3){ if(num1>num2){ if(num2>num3){ return num3; }else{ return num2; } }else{ if(num1>num3){ return num3; }else{ return num1; } } } function checkLye(res,lyeNumList){ if(lyeNumList.length>0){ for(var i=0;i<res.length;i++){ var tag=false; var tmp=res[i]; var num1=0; var num2=0; var num3=0; var oNum; oNum = tmp.substring(0,1); if(oNum=="0" || oNum =="3" || oNum=="6" || oNum=="9"){ num1++; }else if( oNum =="1" || oNum=="4" || oNum=="7"){ num2++; }else if( oNum =="2" || oNum=="5" || oNum=="8"){ num3++; } oNum =tmp.substring(1,2); if(oNum=="0" || oNum =="3" || oNum=="6" || oNum=="9"){ num1++; }else if( oNum =="1" || oNum=="4" || oNum=="7"){ num2++; }else if( oNum =="2" || oNum=="5" || oNum=="8"){ num3++; } oNum =tmp.substring(2,3); if(oNum=="0" || oNum =="3" || oNum=="6" || oNum=="9"){ num1++; }else if( oNum =="1" || oNum=="4" || oNum=="7"){ num2++; }else if( oNum =="2" || oNum=="5" || oNum=="8"){ num3++; } var sum=num1.toString()+num2.toString()+num3.toString()+""; for(var j=0;j<lyeNumList.length;j++){ if(sum==lyeNumList[j]){ tag=true; } } if(!tag){ res.remove(i); i=-1; } } } } //大中小比 function checkDzx(res,dzxNumList){ if(dzxNumList.length>0){ for(var i=0;i<res.length;i++){ var tag=false; var tmp=res[i]; var num1=0; var num2=0; var num3=0; var oNum; oNum = tmp.substring(0,1); if(oNum=="0" || oNum =="1" || oNum=="2" ){ num3++; }else if( oNum =="3" || oNum=="4" || oNum=="5" || oNum=="6"){ num2++; }else if( oNum =="7" || oNum=="8" || oNum=="9"){ num1++; } oNum =tmp.substring(1,2); if(oNum=="0" || oNum =="1" || oNum=="2" ){ num3++; }else if( oNum =="3" || oNum=="4" || oNum=="5" || oNum=="6"){ num2++; }else if( oNum =="7" || oNum=="8" || oNum=="9"){ num1++; } oNum =tmp.substring(2,3); if(oNum=="0" || oNum =="1" || oNum=="2" ){ num3++; }else if( oNum =="3" || oNum=="4" || oNum=="5" || oNum=="6"){ num2++; }else if( oNum =="7" || oNum=="8" || oNum=="9"){ num1++; } var sum=num1.toString()+num2.toString()+num3.toString()+""; for(var j=0;j<dzxNumList.length;j++){ if(sum==dzxNumList[j]){ tag=true; } } if(!tag){ res.remove(i); i=-1; } } } } function checkDm(res){ var dm1 = document.all("dm1").value; var dm2 = document.all("dm2").value; var dm3 = document.all("dm3").value; if(dm1!=-1 || dm2!=-1 || dm3!=-1){ for(var i=0;i<res.length;i++){ var tag=false; if(res[i].indexOf(dm1)!=-1 || res[i].indexOf(dm2)!=-1 || res[i].indexOf(dm3)!=-1){ tag=true; } if(!tag){ res.remove(i); i=-1; } } } } function checkJo(res,joNumList){ if(joNumList.length>0){ for(var i=0;i<res.length;i++){ var tag=false; var tmp=res[i]; var num1=0; var num2=0; var oNum; oNum = tmp.substring(0,1); if(oNum=="1" || oNum =="3" || oNum=="5" || oNum=="7" || oNum=="9"){ num1++; }else if( oNum =="0" || oNum=="2" || oNum=="4" || oNum=="6" || oNum=="8"){ num2++; } oNum =tmp.substring(1,2); if(oNum=="1" || oNum =="3" || oNum=="5" || oNum=="7" || oNum=="9"){ num1++; }else if( oNum =="0" || oNum=="2" || oNum=="4" || oNum=="6" || oNum=="8"){ num2++; } oNum =tmp.substring(2,3); if(oNum=="1" || oNum =="3" || oNum=="5" || oNum=="7" || oNum=="9"){ num1++; }else if( oNum =="0" || oNum=="2" || oNum=="4" || oNum=="6" || oNum=="8"){ num2++; } var sum=num1.toString()+num2.toString()+""; for(var j=0;j<joNumList.length;j++){ if(sum==joNumList[j]){ tag=true; } } if(!tag){ res.remove(i); i=-1; } } } }