网易train

 var sUrl="http://assistant.mail.yeah.net/assistant/train.do";
function fQueryS2S()
{var from=$("from").value;
if(from.trim()=="")
{alert("请输入出发站");
$("from").focus();
return false;
};
var end=$("end").value;
if(end.trim()=="")
{alert("请输入到达站");
$("end").focus();
return false;
};
var sParam="&op=searchs2s&start=0&size=100&queryFrom="+from+"&queryTo="+end,sExtend="&extend={'op':'searchs2s','from':'"+from+"','to':'"+end+"'}";
fTrainCall(sUrl,"fTrainS2SCallBack",sParam,sExtend);
$("queryDiv").style.display="none";
$("loadDiv").style.display="";
return false;
};
function fQueryStation()
{var station=$("station").value;
if(station.trim()=="")
{alert("请输入要查询的车站");
$("station").focus();
return false;
};
var sParam="&op=searchstation&start=0&size=1000&queryStation="+station;
fTrainCall(sUrl,"fTrainStationCallBack",sParam,"&extend={'op':'searchstation'}");
$("queryDiv").style.display="none";
$("loadDiv").style.display="";
return false;
};
function fQueryNumber()
{var stationNumber=$("number").value;
if(stationNumber.trim()=="")
{alert("请输入要查询的车次");
$("number").focus();
return false;
};
var sParam="&op=searchcheci&start=0&size=100&cls="+stationNumber,sExtend="&extend={'op':'searchcheci','cls':'"+stationNumber+"'}";
fTrainCall(sUrl,"fTrainNumberCallBack",sParam,sExtend);
$("queryDiv").style.display="none";
$("loadDiv").style.display="";
return false;
};
function fGoQuery()
{$("numberDiv").style.display="none";
$("stationDiv").style.display="none";
$("s2sDiv").style.display="none";
$("failDiv").style.display="none";
$("queryDiv").style.display="";
return false;
};
function fTrainCall(sUrl,sEvent,sParams,sExtend,sCharSet)
{sUrl+="?event="+sEvent;
if(sParams)
{sUrl+=sParams;
};
if(sExtend)
{sUrl+=sExtend;
};
sUrl+="&patch="+Date.parse(new Date());
fCommonGetScript(sUrl,"gbk");
};
function fTrainNumberCallBack(nCode,oJson,oExtend)
{var nLength=oJson.length;
if(nCode>=0)
{if(nLength==0)
{$("numCheci").innerHTML=oExtend.cls;
$("numberResultDiv").innerHTML='<div class="Cont hbinfo" >无此车次信息</div>';
$("numberDiv").style.display="";
$("loadDiv").style.display="none";
}else{$("numCheci").innerHTML=oJson[0].cls;
$("numCourse").innerHTML=oJson[0].distant;
$("numTime").innerHTML=oJson[0].duration;
var sHtml='<table class="lieche_tab" cellspacing="0" cellpadding="0"><tr> <th>站次</th> <th>站名</th> <th>到达时间</th> <th>开车时间</th> <th>停留时间</th> <th>行车时间</th> <th>里程</th> <th>硬座</th> <th>硬卧下</th> <th>软卧下</th></tr>',nLength=oJson[0].detailList.length;
for(var i=0;
i<nLength;
i++)
{var oTrain=oJson[0].detailList[i];
sHtml+='<tr>';
sHtml+='<td title="站次">'+i+"</td>";
sHtml+='<td title="站名">'+oTrain.zhanming+"</td>";
sHtml+='<td title="到达时间">'+oTrain.reachtime+"</td>";
sHtml+='<td title="开车时间">'+oTrain.leavetime+"</td>";
sHtml+='<td title="停留时间">'+oTrain.waitinterval+"</td>";
sHtml+='<td title="行车时间">'+oTrain.duration+"</td>";
sHtml+='<td title="里程">'+oTrain.distant+" 公里</td>";
sHtml+='<td title="硬座"><span class="CEA5E00">'+((oTrain.price_yingzuo&&oTrain.price_yingzuo!=0)?oTrain.price_yingzuo+" 元":"-")+"</span></td>";
sHtml+='<td title="硬卧下价格">'+((oTrain.price_yingwo&&oTrain.price_yingwo!=0)?oTrain.price_yingwo+" 元":"-")+"</td>";
sHtml+='<td title="软卧下价格">'+((oTrain.price_ruanwo&&oTrain.price_ruanwo!=0)?oTrain.price_ruanwo+" 元":"-")+"</td>";
sHtml+='</tr>';
};
$("numberResultDiv").innerHTML=sHtml;
$("numberDiv").style.display="";
$("loadDiv").style.display="none";
};
}else{$("failDiv").style.display="";
$("loadDiv").style.display="none";
};
};
function fTrainStationCallBack(nCode,oJson,oExtend)
{if(nCode>=0)
{var sHtml='<table class="lieche_tab" cellspacing="0" cellpadding="0"><tr> <th> 车次</th> <th>列车类型</th> <th>起点站—终点站</th> <th>始发时—终点时</th> <th>总里程</th> <th>总时间</th> <th>停留站</th> <th>到站时间</th> <th>停留时间</th></tr>  ',nLength=oJson.length;
for(var i=0;
i<nLength;
i++)
{var oTrain=oJson[i];
if(i==0)
{$("stationName").innerHTML=oTrain.reachstation;
};
sHtml+='<tr id="stationTr'+i+'">';
sHtml+='<td title="车次"><a href="#" οnclick="fTrainStationExtend('+i+',false,/''+oTrain.cls+'/');
return false;
" >'+oTrain.cls+"</a></td>";
sHtml+='<td title="列车类型">'+oTrain.type+"</td>";
sHtml+='<td title="起点站—终点站"><a href="#" id="stationHref'+i+'" οnclick="fTrainStationExtend('+i+',false,/''+oTrain.cls+'/');
return false;
"class="a_k">'+oTrain.startstation+"-"+oTrain.endstation+"</a></td>";
sHtml+='<td title="始发时—终点时">'+oTrain.starttime+"-"+oTrain.endtime+"</td>";
sHtml+='<td title="总里程">'+oTrain.distant+"</td>";
sHtml+='<td title="总时间">'+oTrain.duration+"</td>";
sHtml+='<td title="停留站">'+oTrain.reachstation+"</td>";
sHtml+='<td title="到站时间">'+oTrain.reachtime+"</td>";
sHtml+='<td title="停留时间">'+oTrain.waitinterval+"</td>";
sHtml+='</tr>';
sHtml+='<tr class="lieche_kcont">';
sHtml+='<td id="station'+i+'" colspan="9" style="display:none"><img src="/assist/res/hbload.gif" /> 正在查询列车数据,请稍候...</td>';
sHtml+='</tr>';
};
$("stationLine").innerHTML=nLength;
$("stationResultDiv").innerHTML=sHtml;
$("stationDiv").style.display="";
$("loadDiv").style.display="none";
}else{$("failDiv").style.display="";
$("loadDiv").style.display="none";
};
};
function fTrainStationExtend(index,bHide,checi)
{var oHref=$("stationHref"+index),oTr=$("stationTr"+index);
if(oHref.className=="a_g")
{$("station"+index).style.display="none";
oHref.className="a_k";
oTr.className="";
return;
};
if(oHref.className=="a_k")
{oHref.className="a_g";
oTr.className="lieche_ktit";
};
var sInnerHtml=$("station"+index).innerHTML;
if(sInnerHtml.toLowerCase().indexOf("<img")==0)
{$("station"+index).style.display="";
var sParam="&op=searchcheci&cls="+checi;
fTrainCall(sUrl,"fTrainStationToNumberCallBack",sParam,"&extend={'op':'searchcheci','index':"+index+"}");
return;
}else{$("station"+index).style.display="";
return;
};
};
function fTrainStationToNumberCallBack(nCode,oJson,oExtend)
{if(nCode>=0)
{var oTrainLine=oJson[0],nLength=oTrainLine.detailList.length,sHtml='<div class="lieche_nei"><strong>'+oTrainLine.cls+'</strong> 次列车详细信息<br /><table class="lieche_nei_tab" cellspacing="0" cellpadding="0"><tr> <th>站次</th> <th>站名</th> <th>到达时间</th> <th>开车时间</th> <th>停留时间</th> <th>行车时间</th> <th>里程</th> <th>硬座</th> <th>硬卧下</th> <th>软卧下</th></tr>';
for(var i=0;
i<nLength;
i++)
{var oTrain=oTrainLine.detailList[i],sClass="";
if(i%2==1)
{sClass="lc_trbg";
};
sClass+=" lc_trblack";
sHtml+='<tr class="'+sClass+'">';
sHtml+='<td title="站次">'+(i+1)+"</td>";
sHtml+='<td title="站名">'+oTrain.zhanming+"</td>";
sHtml+='<td title="到达时间">'+oTrain.reachtime+"</td>";
sHtml+='<td title="开车时间">'+oTrain.leavetime+"</td>";
sHtml+='<td title="停留时间">'+oTrain.waitinterval+"</td>";
sHtml+='<td title="行车时间">'+oTrain.duration+"</td>";
sHtml+='<td title="里程">'+oTrain.distant+" 公里</td>";
sHtml+='<td title="硬座价格"><span class="CEA5E00">'+((oTrain.price_yingzuo&&oTrain.price_yingzuo!=0)?oTrain.price_yingzuo+" 元":"-")+"</span></td>";
sHtml+='<td title="硬卧下价格">'+((oTrain.price_yingwo&&oTrain.price_yingwo!=0)?oTrain.price_yingwo+" 元":"-")+"</td>";
sHtml+='<td title="软卧下价格">'+((oTrain.price_ruanwo&&oTrain.price_ruanwo!=0)?oTrain.price_ruanwo+" 元":"-")+"</td>";
sHtml+='</tr>';
};
sHtml+='</table><div class="lieche_zk_bot">';
sHtml+='车次:<span>'+oTrainLine.cls+'</span>';
sHtml+='|  全程时间:<span>'+oTrainLine.duration+'</span> ';
sHtml+='|  全程里程:<span>'+oTrainLine.distant+'</span>';
sHtml+='|  乘车里程:<span>'+oTrainLine.passdistant+'</span> <a href="#" οnclick="fTrainStationExtend('+oExtend.index+',true);
return false">[收起此列车信息↑]</a></div></div>';
$("station"+oExtend.index).innerHTML=sHtml;
$("station"+oExtend.index).style.display="";
}else{$("failDiv").style.display="";
$("loadDiv").style.display="none";
};
};
var aLastS2STrain;
function fTrainS2SCallBack(nCode,oJson,oExtend)
{if(nCode>=0)
{aLastS2STrain=oJson;
var sHtml='<table class="lieche_tab" cellspacing="0" cellpadding="0"><tr> <th> 车次</th> <th>始发站—终点站</th> <th>列车类型</th> <th>出发站—目的站</th> <th>发车时—到达时</th> <th>乘车时间</th> <th>票价</th></tr>  ',nLength=oJson.length;
$("s2sArea").innerHTML=oExtend.from+" - "+oExtend.to;
$("s2sLine").innerHTML=nLength;
for(var i=0;
i<nLength;
i++)
{var oTrain=oJson[i];
sHtml+='<tr id="s2sTr'+i+'">';
sHtml+='<td title="车次"><a href="#" οnclick="fTrainS2SExtend('+i+');
return false;
">'+oTrain.cls+"</a></td>";
sHtml+='<td title="始发站—终点站">'+oTrain.startstation+" - "+oTrain.endstation+"</td>";
sHtml+='<td title="列车类型">'+oTrain.type+"</td>";
sHtml+='<td title="出发站—目的站"><a href="#" id="s2sHref'+i+'" οnclick="fTrainS2SExtend('+i+');
return false;
" class="a_k">'+oTrain.fromstation+" - "+oTrain.tostation+"</a></td>";
sHtml+='<td title="发车时—到达时">'+oTrain.leavetime+" - "+oTrain.reachtime+"</td>";
sHtml+='<td title="乘车时间">'+(oTrain.passduration?oTrain.passduration:" - ")+"</td>";
sHtml+='<td title="票价">硬座:<span class="Cc00">'+((oTrain.priceyingzuo&&oTrain.priceyingzuo!=0)?oTrain.priceyingzuo:"-")+'</span> 元 | 硬卧下:<span class="Cc00">'+((oTrain.priceyingwodown&&oTrain.priceyingwodown!=0)?oTrain.priceyingwodown:"-")+'</span> 元</td>';
sHtml+='</tr>';
sHtml+='<tr class="lieche_kcont">';
sHtml+='<td id="s2s'+i+'" colspan="7" style="display:none"></td>';
sHtml+='</tr>';
};
$("s2sResultDiv").innerHTML=sHtml;
$("s2sDiv").style.display="";
$("loadDiv").style.display="none";
}else{$("failDiv").style.display="";
$("loadDiv").style.display="none";
};
};
function fTrainS2SExtend(index,bHide)
{var oHref=$("s2sHref"+index),oTr=$("s2sTr"+index);
if(oHref.className=="a_g")
{$("s2s"+index).style.display="none";
oHref.className="a_k";
oTr.className="";
return;
};
if(oHref.className=="a_k")
{oHref.className="a_g";
oTr.className="lieche_ktit";
};
if($("s2s"+index).innerHTML!="")
{$("s2s"+index).style.display="";
return;
};
var oTrainLine=aLastS2STrain[index],nLength=oTrainLine.detailList.length,sHtml='<div class="lieche_nei"><strong>'+oTrainLine.cls+'</strong> 次列车详细信息<br /><table class="lieche_nei_tab" cellspacing="0" cellpadding="0"><tr> <th>站次</th> <th>站名</th> <th>到达时间</th> <th>开车时间</th> <th>停留时间</th> <th>行车时间</th> <th>里程</th> <th>硬座</th> <th>硬卧下</th> <th>软卧下</th></tr> ',bBlack=false;
for(var i=0;
i<nLength;
i++)
{var oTrain=oTrainLine.detailList[i],sClass="";
if(i%2==1)
{sClass="lc_trbg";
};
if(oTrainLine.fromstation==oTrain.zhanming)
{bBlack=true;
};
if(bBlack)
{sClass+=" lc_trblack";
};
if(sClass)
{sHtml+='<tr class="'+sClass+'">';
}else{sHtml+='<tr>';
};
if(oTrainLine.tostation==oTrain.zhanming)
{bBlack=false;
};
sHtml+='<td title="站次">'+oTrain.zhanci+"</td>";
sHtml+='<td title="站名">'+oTrain.zhanming+"</td>";
sHtml+='<td title="到达时间">'+oTrain.reachtime+"</td>";
sHtml+='<td title="开车时间">'+oTrain.leavetime+"</td>";
sHtml+='<td title="停留时间">'+oTrain.waitinterval+"</td>";
sHtml+='<td title="行车时间">'+oTrain.duration+"</td>";
sHtml+='<td title="里程">'+oTrain.distant+" 公里</td>";
sHtml+='<td title="硬座价格">'+(oTrain.price_yingzuo&&oTrain.price_yingzuo!=0?oTrain.price_yingzuo+" 元":"-")+"</td>";
sHtml+='<td title="硬卧下价格">'+(oTrain.price_yingwo&&oTrain.price_yingwo!=0?oTrain.price_yingwo+" 元":"-")+"</td>";
sHtml+='<td title="软卧下价格">'+(oTrain.price_ruanwo&&oTrain.price_ruanwo!=0?oTrain.price_ruanwo+" 元":"-")+"</td>";
sHtml+='</tr>';
};
sHtml+='</table><div class="lieche_zk_bot">';
sHtml+='车次:<span>'+oTrainLine.cls+'</span>';
sHtml+='|  全程时间:<span>'+oTrainLine.duration+'</span> ';
sHtml+='|  全程里程:<span>'+oTrainLine.distant+'</span>';
sHtml+='|  乘车里程:<span>'+oTrainLine.passdistant+'</span> <a href="#" οnclick="fTrainS2SExtend('+index+',true);
return false">[收起此列车信息↑]</a></div></div>';
$("s2s"+index).innerHTML=sHtml;
$("s2s"+index).style.display="";
};

练习使用python-numpy的方法——东北大学大数据班数据挖掘Python基础二(1) 实训项目:练习使用numpy的方法。 (1)用0~19的数字生成(4,5)的数组命名为a,查看a的维度;查看a的轴的个数;查看a元素的总个数; (2)创建元素为1,2,3,4的(2,2)的数组 b,查看b中元素类型。 (3)创建一个全1的(4,4)的数组c;创建一个内容随机的(3,2)数组d,并打印d。 (4)用0~11的数,创建一个3*4的数组n1,计算每一列的和;计算每一行的最小值。 (5)生成一个3个元素的数组n2,通过常用函数计算每个元素的平方根;每个元素的标准差。 (6)生成一个9个(可以从0~8)元素的数组n3,计算每个元素的平方根;取出位置2的元素;取出位置2至5之间的元素。 (7)随机生成2个3*3的数组n4和n5,将n4和n5进行垂直合并形成n6;将n4和n5进行水平合并形成n7。 (8)创建一个2行3列的零矩阵命名为z,将z的2行3列的位置值置成1。 (9)生成4*4的对角矩阵,以[1,2,3,4]为对角线,其他位置用0填充,命名为z1 。 (10)用0~8的数,创建成`3*3`的矩阵,命名为z2;用随机数,创建`4*4`的矩阵,命名为z3。 (11)读取iris数据集中的数据。 (12)获取数据中的花萼长度数据。 (13)对花萼长度数据进行排序。 (14)对花萼长度数据进行去重。 (15)对花萼长度数据进行求和。 (16)对花萼长度数据进行求均值。 (17)对花萼长度数据求累计和。 (18)对花萼长度数据求标准差。 (19)对花萼长度数据求方差 。 (20)对花萼长度数据求最大值、最小值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值