<script type="text/javascript" language="javascript">
function diffdate() { var syearItem=document.getElementById( "drop_sYear").selectedIndex.toString(); var smonthItem=document.getElementById("drop_sMonth").selectedIndex.toString(); var sdayItem = document.getElementById("drop_sDay").selectedIndex.toString(); var shourItem = document.getElementById("drop_sHour").selectedIndex.toString(); var eyearItem=document.getElementById( "drop_eYear").selectedIndex.toString(); var emonthItem=document.getElementById("drop_eMonth").selectedIndex.toString(); var edayItem = document.getElementById("drop_eDay").selectedIndex.toString(); var ehourItem = document.getElementById("drop_eHour").selectedIndex.toString(); var startdate=new Date(syearItem,smonthItem,sdayItem,shourItem,"0","00"); var enddate=new Date(eyearItem,emonthItem,edayItem,ehourItem,"0","00"); var diff=((enddate.valueOf()-startdate.valueOf())/(1000*3600*24)); var days = Math.ceil(parseInt(diff))+1; document.getElementById("tb_CostDays").value = days; }
</script>
<tr>
<td class="style5">预计出差<br />
时间</td>
<td colspan="4" class="style2">
<asp:DropDownList
ID="drop_sYear" runat="server" Height="16px" Width="62px"
AutoPostBack="True">
</asp:DropDownList>
年<asp:DropDownList ID="drop_sMonth" runat="server" Height="16px" Width="62px"
AutoPostBack="True" onselectedindexchanged="drop_sMonth_SelectedIndexChanged">
</asp:DropDownList>
月<asp:DropDownList ID="drop_sDay" runat="server" Height="16px" Width="62px">
</asp:DropDownList>
日<asp:DropDownList ID="drop_sHour" runat="server" Height="16px" Width="62px">
</asp:DropDownList>
时<br />
至<asp:DropDownList
ID="drop_eYear" runat="server" Height="16px" Width="62px">
</asp:DropDownList>
年<asp:DropDownList ID="drop_eMonth" runat="server" Height="16px" Width="62px"
AutoPostBack="True" onselectedindexchanged="drop_eMonth_SelectedIndexChanged">
</asp:DropDownList>
月<asp:DropDownList ID="drop_eDay" runat="server" Height="16px" Width="62px">
</asp:DropDownList>
日<asp:DropDownList ID="drop_eHour" runat="server" Height="16px" Width="62px">
</asp:DropDownList>
时</td>
<td class="style2">共<asp:TextBox ID="tb_CostDays" runat="server" Width="62px"
οnfοcus="return diffdate();" />
日</td>
</tr>