You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
5.2 KiB
JavaScript

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function Chk_CC()
{
var tc = document.getElementById("Txt_CC").value;
if (tc == "" || tc =="Train Number")
{
alert("Please input a train number.");
return false;
}
return true;
}
function Chk_ZZ()
{
var tz = document.getElementById("Txt_FZ").value;
if (tz == "" || tz=="Station")
{
alert("You might forget to input a start station.");
return false;
}
tz = document.getElementById("Txt_DZ").value;
if (tz == "" || tz=="Station")
{
alert("You might forget to input a final station.");
return false;
}
return true;
}
function Chk_Z()
{
var Cn = document.getElementById("Txt_Ct").value ;
if (Cn == "" || Cn=="City Name" )
{
alert("Please input the city name you want to search.");
return false;
}
return true;
}
//页面打印
function printpage(){
var newstr = document.getElementById("MainhotelContent").innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = newstr;
window.print();
document.body.innerHTML = oldstr;
}
function fitlerResult(v,type,obj){
if(typeof filterKey=="undefined"){
window.filterKey=['','','',''];
}
if( $(obj).is('input') ){
LabelTxt = $(obj).parent().text();
}else{
LabelTxt = $(obj).html();
}
if(type==1){
filterKey[0]=v;
$('.dropdown>a>span:not(.caret)').eq(0).text(LabelTxt);
}
if(type==2){
filterKey[1]=v;
$('.dropdown>a>span:not(.caret)').eq(1).text(LabelTxt);
}
if(type==3){
filterKey[2]=v;
$('.dropdown>a>span:not(.caret)').eq(2).text(LabelTxt);
}
if(type==4){
filterKey[3]=v;
$('.dropdown>a>span:not(.caret)').eq(3).text(LabelTxt);
}
type = filterKey[0];
time = filterKey[1];
Fst = filterKey[2]; //始发筛选
Tst = filterKey[3]; //终到筛选
$("#searchrsult>tbody:not(:last)").each(function(index){
var t = $(this);
var data = t.attr("data").split("|");
var thisType = data[0];
var thisTime = data[1];
var thisFst = data[2];
var thisTst = data[3];
var a=b=c=d=0;
if( type == "" || ( type!='' && type.indexOf(thisType)!=-1))a=1;
if( time == "" || ( time!='' && time.indexOf(thisTime)!=-1)) b=1;
if( Fst == "" || ( Fst!='' && Fst.indexOf(thisFst)!=-1 )) c=1;
if( Tst == "" || ( Tst!='' && Tst.indexOf(thisTst)!=-1 )) d=1;
if(a&b&c&d){
t.show();
}else{
t.hide();
}
if($("#searchrsult tbody:not(:last):visible").size()==0){
$('#filterTr').show();
}else{
$('#filterTr').hide();
}
})
}
//多项过滤 2019-5-17 zp
function filterMuch(o) {
var filterName = $(o).attr("name");
var s_class = $(o).attr("class");
var s_value = "";
if (s_class == "js_all" && $(o).prop("checked")) { //all 项选择
$(".sorttable input[name='" + filterName + "'][class!='js_all']").attr("checked", false);
s_value = "";
} else {
$(".sorttable input[name='" + filterName + "'][class!='js_all']:checked").each(function (index, element) { //循环获取选择
if ($(this).prop("checked")) {
s_value = s_value + $(this).val() + ",";
}
});
if (s_value.length > 0) {
//去最后的点
s_value = s_value.substring(0, s_value.length - 1);
}
if (s_value == "" || typeof(s_value) == "undefined") { //没得选择
$(".sorttable input[name='" + filterName + "'][class='js_all']").attr("checked", true);
s_vaule = "";
} else {
$(".sorttable input[name='" + filterName + "'][class='js_all']").attr("checked", false);
}
}
if (filterName=="TT"){
filterType = 1
}else if (filterName == "DT"){
filterType = 2
}else if (filterName == "ST"){
filterType =3
}else if (filterName == "AT"){
filterType =4
}
fitlerResult(s_value, filterType, o);
}
//车次详细提示
$(function(){
var timers;
$(".trainNo span strong").hover(
function(){
var leftOffset=$(this).width()+6;
var nObj = $(this).next(".moreTrainId");
var trainNO = $(this).text().replace(/[\/\s]/g,"");
var HTML="";
nObj.css({'left':leftOffset});
if(nObj.html()==""){
var TrinObj = eval('TrainDetail.NO'+trainNO)
for(var i=0; i< TrinObj.length; i ++)
{
HTML += tbtr(TrinObj[i].station, TrinObj[i].station_cn, TrinObj[i].arrival_time, TrinObj[i].depart_time, TrinObj[i].mileage, TrinObj[i].stay_time);
}
HTML = tbHead()+HTML+tbEnd();
nObj.html(HTML);
nObj.show();
} else {
nObj.show();
}
},
function(){
var nObj = $(this).next(".moreTrainId");
hideObj(nObj);
}
);
$(".moreTrainId").hover(
function(){
clearTimeout(timers);
},
function(){$(this).hide()}
);
function hideObj(nObj)
{
timers = setTimeout(function(){nObj.hide()},50);
}
function tbHead()
{
return '<table cellspacing="0" cellpadding="0" width="100%" border="0"><thead><tr><th scope="col"> Train Stations </th><th scope="col"> Stations in Chinese </th><th scope="col"> Arrival Time </th><th scope="col"> Dept. Time </th><th scope="col"> Distance(km) </th><th scope="col"> Total Time<br>(hh:mm)</th></tr></thead>';
}
//Train Stations,Stations in Chinese,Arrival Time, Dept. Time, Distance(km), Total Time (hh:mm)
function tbtr(a,b,c,d,e,f)
{
return '<tr><th scope="row">'+a+'</th><td class="statioinChinese">'+b+'</td><td>'+c+'</td><td>'+d+'</td><td>'+e+'</td><td>'+f+'</td></tr>';
}
function tbEnd()
{
return'</table>';
}
});
//-->