<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'test.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script src="<%=basePath%>js/jquery-1.11.1.min.js"></script>
	
	<script type="text/javascript">
		var t = '${expressType}';//返回快递信息的类型
  		var c = '${expressContent}';//快递内容
  		$(document).ready(function(){
  			$('#divEx').show();
  			var nu = '211001746537';
  	  		var name = 'shunfeng';
  	  		var name2 = "";
	  	  	switch(name){
				case "zhongtong":
				name2 = "中通快递";
				break;
			case "shunfeng":
				name2 = "顺丰速递";
				break;
			case "yuantong":
				name2 = "圆通速递";
				break;
			case "ems":
				name2 = "EMS";
				break;
			case "huitongkuaidi":
				name2 = "汇通快递";
				break;
			}
	  	  if(t=="html"){
	  			if(c!=""){
	  				var tmp = "<p class=\"text2\">快递公司：<strong>"+name2+"</strong>；快递单号：<strong>"+nu+"</strong></p>";
		  			var content = "<iframe name=\"kuaidi100\" src=\""+c+"\" width=\"514\" height=\"300\"";
						content += "marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=\"no\"></iframe>";
					$('#divEx').append(tmp);
					$('#divEx').append(content);
				}
	  		}
	  	else{//json
  			if(c!=""){
  				var msg = "<p class=\"text2\">快递公司：<strong>"+name2+"</strong>；快递单号：<strong>"+nu+"</strong></p>";
  				
	  			var content ="<table class=\"tableExpress\" width=\"514px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"showtablecontext\">";
	  				content += "<tr><td width=\"27%\" class=\"bluebg\" >时间</td>";
	  				content += "<td width=\"73%\" class=\"bluebg\">地点和跟踪进度</td></tr>";
	  			
	  			var info = eval('(' + c + ')');
	  			var tmp = "";
	  			for(var i=0;i<info.data.length;i++){
	  				tmp += "<tr><td class=\"nobg\">";
	  				tmp += info.data[i].time;
	  				tmp += "</td><td class=\"nobg\">";
	  				tmp += info.data[i].context;
	  				tmp += "</td></tr>";
	  			}
	  			
	  			content += tmp;
	  			content += "</table>";
	  			$('#divEx').append(msg);
	  			$('#divEx').append(content);
  			}
  		}
  		});
	</script>
  </head>
  
  <body>
    <div id="divEx" style="display:none;height:300px;width:520px;overflow-y: auto;">
										
	</div>
  </body>
</html>
