插入的自定义代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<input type="button" value="今天" /><input type="button" value="明天"/><input type="button" value="后天"/>
<h4 align="center">注释:剩余票数只能作为参考用</h4>
<div id="div"><h2>请刷新页面 或者稍等片刻</h2></div>
<script type="text/javascript">
var m_date='';
loadXMLDoc();
function get_info(num){
var date=new Date();
var year=date.getFullYear();
var month=date.getMonth()+1;
var day=date.getDate();
if(Number(num)){
day+=Number(num);
if(month==2){
if(year%4){
if(day>28)month+=1;
}else{
if(day>29)month+=1;
}
}else if(month==4||month==6||month==9||month==11){
if(day>30)month+=1;
}else if(day>31) month+=1;
if(month.length==1)month="0"+month;
else if(month==13){
month=1;
year+=1;
}
}
m_date=year+"-"+month+"-"+day;
}
function loadXMLDoc(num){
var xmlhttp;
if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200)make_div(xmlhttp.responseText);
}
get_info(num);
xmlhttp.open("GET","http://t.bjume.com/dataInterface/DI_rank_v2.cfc?method=plan_XDFP&oDate="+m_date+"&oCode=126",true);
xmlhttp.send();
}
function make_div(str){
var arr=str.split("\/Location");
var split_arr=['Title','Country','Movie_Type','Duration','ShowTime','CinemaDesc','Price','Spare_Seats','Language','Name'];
var rt_str='<table align="center" border="1" cellpadding="2" cellspacing="1" ><tr align="center" nowrap="nowrap" height="17"><td>片名</td><td>国家</td><td>类型</td><td>片长(分钟)</td><td>播放时间</td><td>放映厅</td><td>票价</td><td>剩余票数</td><td>备注</td><td>电影院</td></tr>';
rt_str+='';
for(i in arr){
var cell=arr[i];
if(!cell)continue;
if(i==0){
cell=cell.split("Location");
cell=cell[1];
}
var bgcolor='bgcolor="BFBAB8"';
if(i%2)bgcolor='bgcolor="ffffff"';
rt_str+='<tr align="center" '+bgcolor+'>';
for(j in split_arr)rt_str+=get_str(cell,split_arr[j]);
rt_str+='</tr>';
if(i==(arr.length-2))break;
}
rt_str+='</table>';
document.getElementById("div").innerHTML=rt_str;
}
function get_str(str,key){
var matcher='';
if(key=='ShowTime'){
matcher=/\d+[:]+\d+/g;
rt=str.match(matcher);
}else if(key=='CinemaDesc'){
var row=str.split("\"");
rt=row[3];
}else{
var row=str.split("<"+key+">");
row=row[1].split("<\/"+key+">");
rt=row[0];
if(key=='Price')rt+="元";
}
return '<td>'+rt+'</td>';
}
</script>
</body>
</html>
独立保存成文件能正常打开显示,插入成自定义代码,无法刷出数据 |