转:http://www.cnblogs.com/Jinglecat/archive/2007/07/15/818967.html
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FlyOrder.aspx.cs" Inherits="Module_95012_FlyOrder" %>
<%@ Register Assembly="Infragistics.WebUI.WebDateChooser.v5.1, Version=5.1.20051.37, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.WebUI.WebSchedule" TagPrefix="igsch" %>
<!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 runat="server">
<title>机票订购</title>
<script language="javascript">
//根据航程类型,显示不同的控件
function load()
{
var opts=document.all("rbl_FlyWay");
if(opts)
{
for(var i = 0; i < opts.length; i++)
{
if (opts[i].checked)
{
var b=opts[i].value;
if(b==0)
{
document.getElementById("td1").style.display="block";
document.getElementById("Label1").style.display="none";
document.getElementById("Label1").style.display="none";
document.getElementById("Label2").style.display="none";
document.getElementById("txt_EndAddress2").style.display="none";
}
else if(b==1)
{
document.getElementById("td1").style.display="none";
document.getElementById("Label1").style.display="none";
document.getElementById("Label1").style.display="none";
document.getElementById("Label2").style.display="none";
document.getElementById("txt_EndAddress2").style.display="none";
}
else
{
document.getElementById("Label1").style.display="block";
document.getElementById("Label1").style.display="block";
document.getElementById("Label2").style.display="block";
document.getElementById("txt_EndAddress2").style.display="block";
document.getElementById("td1").style.display="none";
}
}
}
}
}
//获得折扣价格
function pricechange()
{
var price=parseFloat(document.all("txt_Price").value);
var zhekou=parseInt(document.all("DDL_ZheKou").value);
var jianshe=parseInt(document.all("txt_FlyJianShe").value);
var fule=parseInt(document.all("txt_Fule").value);
var all=price*zhekou*10/100+jianshe+fule;
document.all("txt_ZheKouPrice").innerText=all;
}
//客户端验证
function check()
{
if (document.all("txt_FlyID").value == "")
{
alert("航班号不能为空!");
return false;
}
if (document.all("txt_BeginAddress").value == "")
{
alert("出发地点不能为空!");
return false;
}
if (document.all("txt_Price").value == "")
{
alert("机票价格不能为空!");
return false;
}
if (document.all("txt_Phone").value == "")
{
alert("联系电话不能为空!");
return false;
}
if (document.all("txt_Card").value == "")
{
alert("身份证号不能为空!");
return false;
}
return true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div >
<table bgcolor="#ffffff" border="1" cellpadding="3" cellspacing="1" style="width: 961px;
height: 297px" align="left">
<tr bgcolor="#e6e9c9">
<td align="right" width="91" style="height: 26px">
<div align="left">
<font color="#000000">航班号:</font></div>
</td>
<td width="242" style="height: 26px">
<asp:TextBox ID="txt_FlyID" runat="server"></asp:TextBox> <font color="#ff0000">
</font></td>
<td align="right" style="width: 86px; height: 26px;">
<div align="left">
<font color="#000000">航程类型:</font></div>
</td>
<td style="width: 414px; height: 26px;">
<asp:RadioButtonList ID="rbl_FlyWay" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="0">往返</asp:ListItem>
<asp:ListItem Value="1" Selected="True">单程</asp:ListItem>
<asp:ListItem Value="2">联程</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="right" bgcolor="#ffffff">
<div align="left">
<font color="#000000">出发地点:</font></div>
</td>
<td bgcolor="#ffffff">
<span style="color: #ff0000">
<asp:TextBox ID="txt_BeginAddress" runat="server" ></asp:TextBox> </span></td>
<td align="right" bgcolor="#ffffff" style="width: 86px; color: #ff0000">
<div align="left">
<font color="#000000">目的地点:</font></div>
</td>
<td bgcolor="#ffffff" style="width: 414px">
<font color="#ff0000">
<asp:Label ID="Label1" runat="server" Text="地点1" style="display:none"></asp:Label>
<asp:TextBox ID="txt_EndAddress1" runat="server" ></asp:TextBox>
<asp:Label ID="Label2" runat="server" Text="地点2" style="display:none"></asp:Label>
<asp:TextBox ID="txt_EndAddress2" runat="server" style="display:none"></asp:TextBox></font></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="right" bgcolor="#ffffff" style="height: 30px">
<div align="left">
<font color="#000000">出发日期:</font></div>
</td>
<td bgcolor="#ffffff" style="height: 30px">
<font color="#ff0000"><span style="color: #000000"> <igsch:WebDateChooser ID="wdc_BeginTime"
runat="server">
<ExpandEffects ShadowColor="LightGray" />
</igsch:WebDateChooser>
</span></font></td>
<td align="right" bgcolor="#ffffff" style="width: 86px; height: 30px">
<div align="left">
<font color="#000000">返回日期:</font></div>
</td>
<td id=td1 bgcolor="#ffffff" style="width: 414px; height: 30px;display:none">
<font color="#ff0000"> <igsch:WebDateChooser ID="wdc_EndTime" runat="server" >
<ExpandEffects ShadowColor="LightGray" />
</igsch:WebDateChooser>
</font></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="right" bgcolor="#ffffff" style="height: 17px">
<div align="left">
<font color="#000000">实际票价:</font></div>
</td>
<td bgcolor="#ffffff" style="height: 17px">
<asp:TextBox ID="txt_Price" runat="server"></asp:TextBox> </td>
<td align="left" bgcolor="#ffffff" style="width: 86px; height: 17px;">
燃油费:</td>
<td bgcolor="#ffffff" style="width: 414px; height: 17px;">
<asp:TextBox ID="txt_Fule" runat="server"></asp:TextBox></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="right" bgcolor="#ffffff" style="height: 17px">
<div align="left">
<font color="#000000">机场建设费:</font></div>
</td>
<td bgcolor="#ffffff" style="height: 17px">
<asp:TextBox ID="txt_FlyJianShe" runat="server"></asp:TextBox></td>
<td bgcolor="#ffffff" style="width: 86px; height: 17px;">
折扣:</td>
<td bgcolor="#ffffff" style="width: 414px; height: 17px;">
<asp:DropDownList ID="DDL_ZheKou" runat="server">
</asp:DropDownList></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="right" bgcolor="#ffffff" style="height: 19px">
<div align="left">
<font color="#000000">折扣票价:</font></div>
</td>
<td bgcolor="#ffffff" style="height: 19px">
<asp:TextBox ID="txt_ZheKouPrice" runat="server"></asp:TextBox></td>
<td align="left" bgcolor="#ffffff" style="height: 19px; width: 86px;" >
舱位等级:</td>
<td bgcolor="#ffffff" style="width: 414px; height: 19px">
<asp:RadioButtonList ID="rbl_Dengji" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="0" Selected="True">经济舱</asp:ListItem>
<asp:ListItem Value="1">公务舱</asp:ListItem>
<asp:ListItem Value="2">头等舱</asp:ListItem>
</asp:RadioButtonList></td>
</tr>
<tr bgcolor="#e6e9c9">
<td align="left" bgcolor="#ffffff" style="height: 5px">
联系电话:</td>
<td bgcolor="#ffffff" style="height: 5px">
<font color="#ff0000">
<asp:TextBox ID="txt_Phone" runat="server"></asp:TextBox></font></td>
<td align="right" bgcolor="#ffffff" style="width: 86px; height: 5px;">
<div align="left">
<font color="#000000">身份证号:</font></div>
</td>
<td bgcolor="#ffffff" style="width: 414px; height: 5px;">
<asp:TextBox ID="txt_Card" runat="server"></asp:TextBox></td>
</tr>
<tr bgcolor="#e6e9c9">
</tr>
<tr bgcolor="#e6e9c9" valign="top">
<td bgcolor="#ffffff" colspan="4" height="35">
<div align="left">
<span class="unnamed1"><font size="2">我还有话要说(备注)</font></span> <span class="unnamed1"><font
size="2"> </font></span><span class="unnamed1"><font color="#ff0000">*<asp:TextBox
ID="txt_Content" runat="server" Height="138px" TextMode="MultiLine" Width="542px"></asp:TextBox></font></span></div>
</td>
</tr>
</table>
</div>
<asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click" />
</form>
</body>
</html>