当用户选择月份的时候,日期根据月份变成30或31
并且自动判断是否为闰年....日期也要随之变化
请问....大家有这样的源代码么??
给我看一看好么....谢谢 ................自己实在写不出来了.............
我正好也在做这个一个,刚刚好有一段代码,也许你能用上!
<!--#include file="Connections/Conn.asp" -->
<%
Dim RS__MMColParam
RS__MMColParam = "1"
If (Request.QueryString("Gnum") <> "") Then
RS__MMColParam = Request.QueryString("Gnum")
End If
%>
<%
Dim RS
Dim RS_numRows
Set RS = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection = MM_Conn_STRING
RS.Source = "SELECT admin, Gnum FROM admin WHERE Gnum = '" + Replace(RS__MMColParam, "'", "''") + "'"
RS.CursorType = 0
RS.CursorLocation = 2
RS.LockType = 1
RS.Open()
RS_numRows = 0
%>
<!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=gb2312" />
<title>结算数据录入</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
body,td,th {
font-size: 12px;
}
.STYLE2 {color: #666666}
.STYLE3 {font-size: 16px; font-weight: bold; color: #FF0000;}
-->
</style></head>
<body onload="YYYYMMDDstart(document.form1,document.form1.SYear,document.form1.SMonth,document.form1.SDay),YYYYMMDDstart(document.form1,document.form1.EYear,document.form1.EMonth,document.form1.EDay)">
<% If RS.EOF And RS.BOF Then %>
<table width="770" border="0" cellpadding="3" cellspacing="1" bgcolor="#0033FF">
<tr>
<td bgcolor="#E1F0FF">对不起,没有在数据库中查找到您所要的数据!</td>
</tr>
<tr>
<td bgcolor="#E1F0FF">本结算系统必须在数据库中已有会员客户的基础上结算,请输入完整的会员编号!</td>
</tr>
</table>
<% End If ' end RS.EOF And RS.BOF %>
<% If Not RS.EOF Or Not RS.BOF Then %>
<table width="770" border="0" cellpadding="3" cellspacing="1" bgcolor="#0033FF">
<form id="form1" name="form1" method="post" action="jssave.asp">
<tr>
<td colspan="2" bgcolor="#E1F0FF"><div align="center" class="STYLE3"> 结算数据录入</div></td>
</tr>
<tr>
<td width="377" bgcolor="#E1F0FF">会员编号: <font color="#cc0000"><%=(RS.Fields.Item("Gnum").Value)%>
<input name="Gnum" type="hidden" id="Gnum" value="<%=(RS.Fields.Item("Gnum").Value)%>" />
</font></td>
<td width="378" bgcolor="#E1F0FF">客户姓名: <%=(RS.Fields.Item("admin").Value)%>
<input name="admin" type="hidden" id="admin" value="<%=(RS.Fields.Item("admin").Value)%>" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#E1F0FF"><strong>数据时间:</strong></td>
</tr>
<tr>
<td colspan="2" bgcolor="#E1F0FF"> 起始日期:
<select name=SYear onchange="YYYYDD(this.value,document.form1.SMonth,document.form1.SDay)">
<option value="" selected="selected">年</option>
</select>年
<select name=SMonth onchange="MMDD(this.value,document.form1.SYear,document.form1.SDay)">
<option value="" selected="selected">月</option>
</select>月
<select name=SDay>
<option value="" selected="selected">日</option>
</select>
日
<input name="STday" type="hidden" id="STday" />
<br><br>
截止日期:
<select name=EYear onchange="YYYYDD(this.value,document.form1.EMonth,document.form1.EDay)">
<option value="" selected="selected">年</option>
</select>年
<select name=EMonth onchange="MMDD(this.value,document.form1.EYear,document.form1.EDay)">
<option value="" selected="selected">月</option>
</select>月
<select name=EDay>
<option value="" selected="selected">日</option>
</select>
日 <input name="Enday" type="hidden" id="Enday" />
<span class="STYLE2">请选择客户的时间段</span></td>
</tr>
<tr>
<td bgcolor="#E1F0FF">操作手数:
<input name="hand" type="text" id="hand" /></td>
<td bgcolor="#E1F0FF">佣金标准:
<input name="bz" type="text" id="bz" />
<span class="STYLE2">请只输入数字,不输入单位</span></td>
</tr>
<tr>
<td bgcolor="#E1F0FF">结算金额:
<input name="mon" type="text" id="mon" />
<span class="STYLE2">佣金结算金额=手数*标准</span></td>
<td bgcolor="#E1F0FF">盈亏金额:
<input name="yk" type="text" id="yk" />
<span class="STYLE2">请只输入数字,不输入单位</span></td>
</tr>
<tr>
<td colspan="2" bgcolor="#E1F0FF"><strong>会员缴费</strong>:</td>
</tr>
<tr>
<td bgcolor="#E1F0FF">缴费金额:
<input name="jmon" type="text" id="jmon" /></td>
<td bgcolor="#E1F0FF">缴费时间:
<input name="gtime" type="text" id="gtime" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#E1F0FF">详细备注:
<textarea name="jtxt" cols="50" rows="8" id="jtxt"></textarea></td>
</tr>
<tr>
<td colspan="2" bgcolor="#E1F0FF"><div align="center">
<input type="submit" name="Submit" value="提交" />
<input type="reset" name="Submit2" value="重置" />
</div></td>
</tr>
</form>
</table>
<% End If ' end Not RS.EOF Or NOT RS.BOF %>
<script language="JavaScript"><!--
function YYYYMMDDstart(form,year,month,day)
{
MonHead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
//先给年下拉框赋内容
var y = new Date().getFullYear();
for (var i = (y-1); i < (y+2); i++) //以今年为准,前30年,后30年
year.options.add(new Option(i,i));
//赋月份的下拉框
for (var i = 1; i < 13; i++)
month.options.add(new Option(i,i));
year.value = y;
month.value = new Date().getMonth() + 1;
var n = MonHead[new Date().getMonth()];
if (new Date().getMonth() ==1 && IsPinYear(year.options[year.selectedIndex].value)) n++;
writeDay(n,day); //赋日期下拉框Author:meizz
day.value = new Date().getDate();
}
function YYYYDD(str,month,day) //年发生变化时日期发生变化(主要是判断闰平年)
{
var MMvalue = month.options[month.selectedIndex].value;
if (MMvalue == "" ){ var e = day; optionsClear(e); return;}
var n = MonHead[MMvalue - 1];
if (MMvalue ==2 && IsPinYear(str)) n++;
writeDay(n,day)
}
function MMDD(str,year,day) //月发生变化时日期联动
{
var YYYYvalue = year.options[year.selectedIndex].value;
if (YYYYvalue == "" ){ var e = day; optionsClear(e); return;}
var n = MonHead[str - 1];
if (str ==2 && IsPinYear(YYYYvalue)) n++;
writeDay(n,day)
}
function writeDay(n,day) //据条件写日期的下拉框
{
var e = day; optionsClear(e);
for (var i=1; i<(n+1); i++)
e.options.add(new Option(i,i));
}
function IsPinYear(year)//判断是否闰平年
{ return(0 == year%4 && (year%100 !=0 || year%400 == 0));}
function optionsClear(e)
{
for (var i=e.options.length; i>0; i--)
e.remove(i);
}
function compDate(SY,SM,SD,EY,EM,ED)
{
}
//--></script>
</body>
</html>
<%
RS.Close()
Set RS = Nothing
%>
[此贴子已经被作者于2006-3-28 17:27:58编辑过]