⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 b0d6e0ab3b40001d1bbeb58f3f6dcbed

📁 自己做的一个火车票售票网站是课程设计 用的是servlet+jsp 数据库是ms
💻
字号:
<%@ page contentType="text/html;charset=utf-8"  pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.vo.*" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
html,body,img,ul,li,h3,form,a{margin:0;padding:0;}
body{
font-family:"宋体";
font-size:12px;
color:#000000}
a{color:#000000;
text-decoration:none;}
a:hover{color:#FF0000;}
img{border:0}
#main{width:760px;}
#headtop{background-image:url(img/f5bb2058433f7bd09d82045f.jpg);}
#head{
background-image:url(img/bg2.png);
padding:0;
margin:0;
width:100%;
border-bottom:2px dashed #e4da56;
position:relative;
}
#headleft{
margin:0;
padding:0;
float:left;
}
#headright {
	margin:0;
	padding:0;
	position:absolute;
	right: 20px;
	bottom: 0px;
}
#headright ul{float:right;
}
#headright li{display:inline;}
#login{z-index:3;
float:left;
color:#FF0000;}
#content{
width:100%;
margin-top:10px;
margin-bottom:10px;}
#contentleft{
width:65%;
float:left;}
table td{border:1px solid #e4da56;}
#contentright{
border:1px solid #e4da56;
padding-left:20px;
padding-top:20px;
padding-bottom:20px;
width:30%;
float:right;
text-align:left;}
#bottom2{float:left;width:100%;margin-top:20px;}
#bottom2-1{width:100%;}
#bottom2-1 ul li {

float:left;
border-left:2px solid #e4da56;
border-right:2px solid #e4da56;
margin-right:2px;
border-top:2px solid #e4da56;
padding-left:50px;
padding-right:50px;
padding-top:10px;
padding-bottom:10px;}
#bottom2-2{clear:both;text-align:left;padding:20px;height:80px;width:587px;
border-left:2px solid #e4da56;
border-right:2px solid #e4da56;
border-bottom:2px solid #e4da56;
float:left;
font-family:"黑体";
font-size:15px;}
#bottom2-2 span{color:#FF0000;}
.dis{display:block;}
.undis{display:none;}
.change{border-top:2px solid #e4da56;
border-left:2px solid #e4da56;
border-right:2px solid #e4da56;
border-bottom:2px solid #ffffff;}
.unchange{background-color:#e4da56;}
.inputstyle{
background-image:url(img/search1.gif);
width:82px;
border:none;
}
.inputstyle2{
background-image:url(img/amusement18.gif);
width:44px;
border:none;
}
.inputstyle1{border:1px solid #000000;}
</style>
<script type="text/javascript">
function go(o){return document.getElementById(o);}
function hover(n){
for (var i=1;i<4;i++){
go('tab_'+i);go('tab'+i).className='undis';go('tab_'+i).className='unchange'}
go('tab'+n).className='dis';
go('tab_'+n).className='change';
go('tab_'+n);}
</script>
<script language="javascript">
function jisuan(){
var start=document.getElementById("startchezhan").value;
var end=document.getElementById("endchezhan").value;
var checi=document.myform.checi.value;
//alert(checi);alert(end);
//alert(start);
send_request1("ajax2.jsp?code="+encodeURIComponent(start)+"&code1="+encodeURIComponent(end)+"&code2="+checi);
}
var Currobj=null;
//parentobj上级对象
function changecode(parentobj,obj)
{
    if (obj==null) return ;
    obj.length = 0;
    Currobj=obj;
    var selectcode=parentobj.options[parentobj.selectedIndex].value;
    //alert(selectcode);
   obj.options[0] = new Option('请选择车厢','');
    document.getElementById("datapro").innerHTML = "正在取数据,请稍后......";
    send_request("ajax.jsp?code="+selectcode);
}
function changecode1(parentobj,obj)
{
    if (obj==null) return ;
    obj.length = 0;
    Currobj=obj;
    var selectcode=parentobj.options[parentobj.selectedIndex].value;
   // alert(selectcode);
   obj.options[0] = new Option('请选择座位','');
    document.getElementById("datapro").innerHTML = "正在取数据,请稍后......";
    send_request("ajax1.jsp?code1="+selectcode);
}
var http_request = false;
//向服务器发起XMLHTTP请求。
function send_request(url)
{//初始化、指定处理函数、发送请求的函数
    http_request = false;
    //开始初始化XMLHttpRequest对象
    if(window.XMLHttpRequest)
    { //Mozilla 浏览器
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {//设置MiME类别
            http_request.overrideMimeType('text/xml');
        }
    }
    else if (window.ActiveXObject)
    { // IE浏览器
        try
        {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e)
        {
            try
            {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}
        }
    }
    if (!http_request)
    { // 异常,创建对象实例失败
        window.alert("不能创建XMLHttpRequest对象实例.");
        return false;
    }
    http_request.onreadystatechange = processRequest;
    http_request.open("POST", url, true);
    http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 
    http_request.send(null);
}
function send_request1(url)
{//初始化、指定处理函数、发送请求的函数
    http_request = false;
    //开始初始化XMLHttpRequest对象
    if(window.XMLHttpRequest)
    { //Mozilla 浏览器
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {//设置MiME类别
            http_request.overrideMimeType('text/xml');
        }
    }
    else if (window.ActiveXObject)
    { // IE浏览器
        try
        {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e)
        {
            try
            {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {}
        }
    }
    if (!http_request)
    { // 异常,创建对象实例失败
        window.alert("不能创建XMLHttpRequest对象实例.");
        return false;
    }
    http_request.onreadystatechange = processRequest1;
    http_request.open("POST", url, true);
    http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 
    http_request.send(null);
}
function processRequest()
{
    if (http_request.readyState == 4)
    { // 判断对象状态
        if (http_request.status == 200)
        { // 信息已经成功返回,开始处理信息
            var returnStr = http_request.responseText;
			//returnStr=returnStr.replace(/(^[\\s]*)|([\\s]*$)/g, "");
            if(returnStr.indexOf("Error")==-1) //正确
            {
                var list = returnStr.split('$');
                var len =list.length;
                var line;
                for(var i=0; i<len-1; i++)
                {
                    line=list[i];
                    if (line!="")
                    {
                        if(line.length>0)
                        { alert(line+":line");
                        //line=line.replace(/(^[\\s]*)|([\\s]*$)/g,"");//删除空格  
                            Currobj.options[Currobj.length]
                            = new Option(line,line);
                        }
                    }
                }
                document.getElementById("datapro").innerHTML = "取数据完成";
            }
            else
            {
                document.getElementById("datapro").innerHTML = "错误";
            }
        } else
        { //页面不正常
            alert("您所请求的页面有异常。");
        }
    }
}
function processRequest1()
{
    if (http_request.readyState == 4)
    { // 判断对象状态
        if (http_request.status == 200)
        { // 信息已经成功返回,开始处理信息
            document.getElementById("showText").innerHTML = "您要付的车费为"+http_request.responseText+"¥";
		}
	}
}	
</script>
</head>
<body>
<center>
<div id="main">
<div id="head">
<div id="headtop">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','760','height','120','title','xianshi','src','flash/1','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','flash/1','wmode','transparent' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="760" height="120" title="xianshi">
  
  <param name="movie" value="flash/1.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="transparent" />
  <embed src="flash/1.swf" width="760" height="120" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
</object>
</noscript>
</div>
<div id="headleft">
<img src="img/train.gif" />
</div>
<div id="headright">
<%String userName=(String)request.getSession().getAttribute("name"); %>

<ul>
<li><span id="login"><h4>欢迎:<%=userName %></h4></span></li>
<li><img src="img/health10.gif" /></li>
<li><a href="main.jsp" target="_top"><img src="img/images021.gif"/></a></li>
<li><img src="img/health10.gif" /></li>
<li><a href="zhuce1.jsp" target="_top"><img src="img/bt_register_b.gif"/></a></li>
</ul>
</div>
</div>
<div id="bottom2">
<div id="bottom2-1">
<ul>
<li id="tab_1" class="change" onmouseover="hover(1)"><h3>始发/终点(站)搜索</h3></li>
<li id="tab_2" class="unchange" onmouseover="hover(2)"><h3>车站查询</h3></li>
<li id="tab_3" class="unchange" onmouseover="hover(3)"><h3>车次查询</h3></li>
</ul>
</div>
<div id="bottom2-2">

<div id="tab1" class="dis"><form action="/kechengsheji/StartEndServlet" method="post" target="_top"><img src="img/d_search.gif" />我要搜&nbsp;<span>始发站</span><input type="text" value="哈尔滨" name="start" class="inputstyle1"/>&nbsp;<span>终点站</span><input type="text" name="end" class="inputstyle1"/>&nbsp;<input type="submit"  class="inputstyle" value="" /><br /><p></p>
(本站只提供哈尔滨列车时刻服务,所以默认始发站为<span>哈尔滨</span>)</form>
</div>
<div id="tab2" class="undis"><form action="/kechengsheji/ChezhanServlet" method="post" target="_top"><img src="img/d_search.gif" />我要搜&nbsp;<span>车站</span><input type="text" class="inputstyle1" name="ChezhanName" />&nbsp;<input type="submit" class="inputstyle" value=""/><br /><p></p>
(查询进过<span>本车站</span>的所有列车车次)
</form>
 </div>
<div id="tab3" class="undis"><form action="/kechengsheji/CheciServlet" method="post" target="_top"><img src="img/d_search.gif" />我要搜&nbsp;<span>车次</span><input type="text" class="inputstyle1" name="CheciNumber"/>&nbsp;<input type="submit" class="inputstyle" value="" /><br /><p></p>
(查询<span>此车次</span>的详细路线)
</form>
</div>

</div>
</div>
<div id="content">
<div id="contentleft">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
转让/求购
</td>
<td>
留言人
</td>
<td>
内容
</td>
<td>
留言时间
</td>
</tr>
<%ArrayList al=(ArrayList)request.getAttribute("liuyan");
Iterator it =al.iterator();
while(it.hasNext()){
LiuyanVO vo =(LiuyanVO)it.next();
String type=vo.getType();
String name=vo.getName();
String content=vo.getContent();
String liuyanTime=vo.getLiuyanTime();
%>
<tr>
<td><%=type %></td>
<td><%=name %></td>
<td><%=content %></td>
<td><%=liuyanTime %></td>
</tr>
<%} %>
</table>
</div>
<div id="contentright">
<form action="chepiao.jsp" method="post"
			enctype="application/x-www-form-urlencoded" name="myform"
			target="_self"> 
			车次:&nbsp;
			<select name="checi" onchange="changecode(checi,chexiang)">
				<%
					com.ajax.Ajax op=new com.ajax.Ajax();
					out.println(op.getMessage());
				%>
			</select><br/><p></p>
			车厢:&nbsp;
			<select name="chexiang" onchange="changecode1(chexiang,zuowei)">
				<option selected value="">
					您可以预定的车厢
				</option>
			</select><br /><p></p>
			座位:&nbsp;
			<select name="zuowei">
				<option selected value="">
					您可以预定的座位
				</option>
			</select>
			<label id="datapro">
				&nbsp;
			</label>
			<br/><p></p>
			日期(月)<input type="text" name="month" size="10"/>
			日期(日)<input type="text" name="day"/ size="10"/>
			始发站:<input type="text" id="startchezhan" name="startchezhan" size="10"/><br/><p></p>
			终点站:<input type="text" id="endchezhan" name="endchezhan" size="10"/><br/><p></p>
			<input type="button" onclick="jisuan()" value="查看票价"/> 
			<span id="showText"></span><br/>
			<input type="submit"/>
		</form>
</div>
</div>
<div id="footer">
<iframe src="footer.html" frameborder="0" scrolling="no" width="760px" id="mainIframe2" name="mainIFrame2">
</iframe>
</div>
</div>
</center>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -