<% for i=1 to 12%>
-----------------<form name="form1" method="post" onsubmit="return check();">
<select name= "d_year" style="width:50pt;">
<% for i=2008 to 2020%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>年
<select name="d_month" style="width:30pt;">
<% for i=1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>月
<input type="hidden" name="hd">
<input type="submit" name="Submit" value="统计" />
</form><script>
function check(){
var iYear = document.form1.d_year.options[document.form1.d_year.selectedIndex].value;
var iMonth = document.form1.d_month.options[document.form1.d_month.selectedIndex].value;
var s = iYear + "-" + iMonth;
alert(s);
document.hd.value=s;
}
</script>
-----------------<form name="form1" method="post" onsubmit="return check();">
<select name= "d_year" style="width:50pt;">
<% for i=2008 to 2020%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>年
<select name="d_month" style="width:30pt;">
<% for i=1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>月
<input type="hidden" name="hd">
<input type="submit" name="Submit" value="统计" />
</form><script>
function check(){
var iYear = document.form1.d_year.options[document.form1.d_year.selectedIndex].value;
var iMonth = document.form1.d_month.options[document.form1.d_month.selectedIndex].value;
var s = iYear + "-" + iMonth;
alert(s);
document.hd.value=s;
}
</script>
解决方案 »
- 求助:JS代码问题,郁闷死我了????
- 不知道为什么出现这个错误,高手帮忙看看
- 添加题目没有弹出窗,头晕,请各位给看看?
- 一个页的的contentEdittable设为true后怎样触发事件
- 如何自动POST数据?
- ======================如何实现类似新浪网首页顶部只出现3秒就消失的大幅广告?==========================
- 我想在日历里显示"农历壬午年(马) 七月十九 ",是怎样做的呢?
- 请问,如何通过一个按钮的onclick事件,在同一窗口打开其他的窗口?
- konockout foreach有无限树型子级的数据,请问有什么好方法?
- 使用阿里云播放器,video播放时控制进度条拖动在小米手机上不生效,有解决办法吗?
- 高分求解高难度问题:关于字符串的替换
- myform.upfile.value upfile是变量
sql = "select * from tbl where datediff(m,YOUR_DATE_FIELD,'" & s & "-1')=0"
Access
sql = "select * from tbl where datediff('m',YOUR_DATE_FIELD,'" & s & "-1')=0"
这个是大致的代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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">
table.news_table
{
border: 1px;
border-style: dotted;
border-color: #00CC99;
border-top: 0;
font-size: 14px;
background: #FFFFFF;
color: #669999;
}
table.news_table thead tr
{
color: #FFFFFF;
background: #0099CC;
border-bottom: 2px solid #FF0000;
padding: 2px 10px;
}
table.news_table tbody tr
{
padding: 2px 10px;
}
</style>
</head>
<script>
function InitDB()
{
conn = null;
rs = null;
conn = new ActiveXObject("ADODB.Connection");
rs = new ActiveXObject("ADODB.Recordset");
connstr = "Driver={SQL Server}; Server=(local); Database=GQBD; UID=sa; PWD=15402852";
} function check()
{
var iYear = document.form1.d_year.options[document.form1.d_year.selectedIndex].value;
var iMonth = document.form1.d_month.options[document.form1.d_month.selectedIndex].value;
var s = iYear + "-" + iMonth;
//alert(s);//s就是年月
document.hd.value=s;
//strsql = "select * from t_statistics where datediff(mm, '%"& s &"%' , d_date) = 0"
conn.Open(connstr);
strsql = "select * from t_statistics where datediff(mm, '%"& s &"%' , d_date) = 0"
rs.open strsql,conn,1,3
}
</script>
<body >
<div align="center">
<form name="form1" method="post" onsubmit="check();">
<select name= "d_year" style="width:50pt;">
<% for i=2008 to 2020%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
年
<select name="d_month" style="width:30pt;">
<% for i=1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>
月
<input type="hidden" name="hd">
<input type="submit" name="Submit" value="统计" />
</form>
</div>
<%
Sub loadcontent()
dim conn
dim connstr
on error resume next
connstr="Driver={SQL Server};Server=192.168.0.103;UID=sa;PWD=15402852;Database=GQBD"
set conn=server.createobject("ADODB.CONNECTION")
set Rs=Server.CreateObject("ADODB.RecordSet")
conn.open connstr strsql = "select * from t_statistics where datediff(mm, '%"& s &"%' , d_date) = 0" rs.open strsql,conn,1,3
<table width="770" border="0"align="center" cellpadding="0" cellspacing="0" class="news_table">
<thead>
<tr>
<th width="157" height="30" scope="col">日期</th>
<th width="134" scope="col">接收短信条数</th>
<th width="191" scope="col">返回短信条数</th>
<th width="193" scope="col">收费短信条数</th>
<th width="164" scope="col">合计</th>
</tr>
</thead>
<tbody>
<%
'//---获取结构填充表格---response.Write("<td>"escape(&rs("s_MsgContent")&)"</td>")
response.charset = "gb2312"
if rs.bof and rs.eof then
response.Write("no record")
else
while not rs.eof
response.Write("<tr>")
response.Write("<td>"&rs("d_date") &"</td>")
response.Write("<td>"&rs("i_receive")&"</td>")
response.Write("<td>"&rs("i_send")&"</td>")
response.Write("<td>"&rs("i_charge")& "</td>")
response.Write("<td>"&rs("m_total")& "</td>")
response.Write("</tr>")
rs.movenext
wend
end if
'//---获取结构填充表格-
%>
</tbody>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=Nothing
End Sub
%>
</body>
</html>
帮忙看看,谢谢。
{
conn = null;
rs = null;
conn = new ActiveXObject("ADODB.Connection");
rs = new ActiveXObject("ADODB.Recordset");
connstr = "Driver={SQL Server}; Server=(local); Database=GQBD; UID=sa; PWD=15402852";
}
贴代码以便参考!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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">
table.news_table
{
border: 1px;
border-style: dotted;
border-color: #00CC99;
border-top: 0;
font-size: 14px;
background: #FFFFFF;
color: #669999;
}
table.news_table thead tr
{
color: #FFFFFF;
background: #0099CC;
border-bottom: 2px solid #FF0000;
padding: 2px 10px;
}
table.news_table tbody tr
{
padding: 2px 10px;
}
</style></head>
<script language="javascript">//这个函数将SELECT标签值给隐藏表单SELECT_TEXT
function show()
{
form1.select_text1.value=form1.d_year.options[form1.d_year.selectedIndex].value;
form1.select_text2.value=form1.d_month.options[form1.d_month.selectedIndex].text;
form1.submit();
}
</script>
<body>
<div align="center">
<form name="form1" action="statistics.asp">
<select name= "d_year" style="width:50pt;">
<% for i=2008 to 2015%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select> 年
<select name="d_month" style="width:30pt;">
<% for i=1 to 12%>
<option value="<%=i%>"><%=i%></option>
<%next%>
</select>月
<input type="hidden" name="select_text1">
<input type="hidden" name="select_text2">
<input type=button name="su" value="统计" onclick="javascript:show();" />
</form>
</div>
<%
iYear = request("select_text1")'response.write (ddd)
iMonth = request("select_text2")'response.write (www)
fff = "-"
iDay = "-01"
d_date1 = iYear +fff+ iMonth
d_date = iYear +fff+ iMonth + iDay
' response.write (d_date)
dim conn
dim connstr
on error resume next
connstr="Driver={SQL Server};Server=192.168.0.103;UID=sa;PWD=15402852;Database=GQBD"
set conn=server.createobject("ADODB.CONNECTION")
set Rs=Server.CreateObject("ADODB.RecordSet")
conn.open connstr
strsql = "select * from t_statistics where datediff(mm, d_date, '"&d_date&"' ) = 0" 'response.write (d_date)
'response.write (strsql)
rs.open strsql,conn,1,3%>
<table width="578" border="0"align="center" cellpadding="0" cellspacing="0" class="news_table">
<thead>
<tr>
<th width="96" height="30" scope="col">日期</th>
<th width="128" scope="col">接收短信条数</th>
<th width="144" scope="col">返回短信条数</th>
<th width="129" scope="col">收费短信条数</th>
<th width="79" scope="col">合计</th>
</tr>
</thead>
<tbody>
<% '//---获取结构填充表格---response.Write("<td>"escape(&rs("s_MsgContent")&)"</td>")
response.charset = "gb2312"
if rs.bof and rs.eof then
response.Write("no record")
else
while not rs.eof
response.Write("<tr>")
response.Write("<td>"&rs("d_date") &"</td>")
response.Write("<td>"&rs("i_receive")&"</td>")
response.Write("<td>"&rs("i_send")&"</td>")
response.Write("<td>"&rs("i_charge")& "</td>")
response.Write("<td>"&rs("m_total")& "</td>")
response.Write("</tr>")
rs.movenext
wend
'sql = "select sum(i_receive)as total_receive ,sum(i_send)as total_send,sum(i_charge)as total_charge, sum(m_total)as total from t_statistics where datediff(mm, d_date, '"&d_date&"' ) = 0"
'rs.open sql,conn,1,3
'response.Write("<tr>")
'response.Write("<td>"&d_date1&"</td>")
'response.Write("<td>"&rs("total_receive")&"</td>")
'response.Write("<td>"&rs("total_send")&"</td>")
'response.Write("<td>"&rs("total_charge")& "</td>")
'response.Write("<td>"&rs("total")& "</td>")
'response.Write("</tr>")
end if
%>
</tbody>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=Nothing
%>
</body>
</HTML>