| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 686 人关注过本帖
标题:[求助]如何让数据在指定的表格内显示
只看楼主 加入收藏
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
 问题点数:0 回复次数:9 
[求助]如何让数据在指定的表格内显示
周一 周二 周三 周四 周五 周六 周日
280 320 110 150 120 500
580 650
比如我查询的是2007-6-1至2007-6-8日之间的数据,,因为6-1日是周二..下面是八天.所以数据就以周二开始显示...
但是我不知道下面的指定表格应该怎么样才能让得到的数据在里面指定显示呢???
我数据库中是以1到31为标题.然后经过DAY(DEPDATE)指到日期的尾数.来读取标题下的数据...但是要怎么样才能显示在上面的表格中..
搜索更多相关主题的帖子: 表格 数据 TABLE 
2007-05-30 01:18
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
[QUOTE]<tr>
<td></td>
<%
for i=1 to 31
if i mod 7=0 then
response.write "</tr><tr>"
end if
%>
<td><%=i%></td>
<%
next
%>
</tr>[/QUOTE]
楼主是这个意思吗?

[此贴子已经被作者于2007-5-30 3:06:55编辑过]

2007-05-30 03:06
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
收藏
得分:0 
楼上写的并不是楼主要的,你那只是每7列换行.
楼主要的没有那么简单,他那还要判断几号是星期几呢.
2007-05-30 08:37
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
得分:0 
那版主帮我看看应该怎么样写呢??我发个图给您看看
图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册

代码应该怎么样才能实现
2007-05-31 00:16
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

[QUOTE]有点像月历,以前写过,我的思路是这样的:

1、根据对应的日期,生成一个月历表格并和星期对应;

2、阅历中单元格里显示的是日期,这里,你可以根据这个日期去查询数据库,提取对应日期的数据显示出来;[/QUOTE]


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-31 08:53
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
日历的程序在网络上有的!你可以自己去查查,他们已经写得很好的函数出来了,是一个ASP日历!

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2007-05-31 10:29
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 

[QUOTE]<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
body, p, div,td,input {font:menu;line-height: 150%}
.div { font-family: 宋体; font-size: 12px; line-height: 150% }
-->
</style>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
//创建一个数组,用于存放每个月的天数
function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
{
this[0] = m0;
this[1] = m1;
this[2] = m2;
this[3] = m3;
this[4] = m4;
this[5] = m5;
this[6] = m6;
this[7] = m7;
this[8] = m8;
this[9] = m9;
this[10] = m10;
this[11] = m11;
}
//实现月历
function calendar() {
var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
var today = new Date();
var thisDay;
var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
year = today.getYear() +1900;
thisDay = today.getDate();
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
nDays = monthDays[today.getMonth()];
firstDay = today;
firstDay.setDate(1);
testMe = firstDay.getDate();
if (testMe == 2) firstDay.setDate(0);
startDay = firstDay.getDay();
document.write("<div id='rili' style='position:absolute;width:140px;left:300px;top:100px;'>")
document.write("<TABLE width='217' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'>")
document.write("<TR><TD><table border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'>");
document.write("<TR><th colspan='7' bgcolor='#C8E3FF'>");
var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var now = new Date();
document.writeln("<FONT STYLE='font-size:9pt;Color:#330099'>" + "公元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "</FONT>");
document.writeln("</TH></TR><TR><TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>日</FONT></TH>");
document.writeln("<th bgcolor='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>一</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>二</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>三</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>四</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>五</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>六</FONT></TH>");
document.writeln("</TR><TR>");
column = 0;
for (i=0; i<startDay; i++) {
document.writeln("\n<TD><FONT STYLE='font-size:9pt'> </FONT></TD>");
column++;
}
for (i=1; i<=nDays; i++) {
if (i == thisDay) {
document.writeln("</TD><TD ALIGN='CENTER' BGCOLOR='#FF8040'><FONT STYLE='font-size:9pt;Color:#ffffff'><B>")
}
else {
document.writeln("</TD><TD BGCOLOR='#FFFFFF' ALIGN='CENTER'><FONT STYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066'>");
}
document.writeln(i);
if (i == thisDay) document.writeln("</FONT></TD>")
column++;
if (column == 7) {
document.writeln("<TR>");
column = 0;
}
}
document.writeln("<TR><TD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#0080FF'>")
document.writeln("<FORM NAME='clock' onSubmit='0'><FONT STYLE='font-size:9pt;Color:#ffffff'>")
document.writeln("现在时间:<INPUT TYPE='Text' NAME='face' ALIGN='TOP'></FONT></FORM></TD></TR></TABLE>")
document.writeln("</TD></TR></TABLE></div>");
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
//显示当前时间
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = " " + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " 下午 " : " 上午 "
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示
timerRunning = true;}
function startclock () {
stopclock();
showtime();}
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" onLoad="startclock(); timerONE=window.setTimeout"text="#000000">
<script language="JavaScript" type="text/javascript">
<!--
calendar();
//-->
</script>
</body>
</html>[/QUOTE]

日历可以参考一下这个程序

2007-05-31 11:42
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
楼上给的是JS的,楼主应该是需要一个ASP的,

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-31 11:46
enlangs
Rank: 1
等 级:等待验证会员
威 望:2
帖 子:218
专家分:0
注 册:2007-5-28
收藏
得分:0 
晕...到现在都还没有看懂楼主的问题..
2007-05-31 12:06
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
[QUOTE]<form method="get" name="DateSelect" action="temp.asp">
<tr>
<td align="center" class="pt9-000099" >ASP动态日历</td>
</tr>
<tr>
<td bgcolor="#006699">
<table width="100%" height="25" border=0 cellpadding=2 cellspacing="1" class="pt9">
<tr align="center" class="pt9-000099">
<td background="../../images/bg_mask.gif">周日</td>
<td background="../../images/bg_mask.gif">周一</td>
<td background="../../images/bg_mask.gif">周二</td>
<td background="../../images/bg_mask.gif">周三</td>
<td background="../../images/bg_mask.gif">周四</td>
<td background="../../images/bg_mask.gif">周五</td>
<td background="../../images/bg_mask.gif">周六</td>
</tr>
<tr bgcolor="#ffffc0">
<%
dim nDex, nMonth, nYear, dtDate
dtDate = Now()
nMonth = Request.QueryString("nMonth")
nYear = Request.QueryString("nYear")
if nMonth = "" then nMonth = Month(dtDate)
if nYear = "" then nYear = Year(dtDate)
dtDate = DateSerial(nYear, nMonth, 1)
for nDex = 1 to Weekday(dtDate) - 1
Response.Write "<td bgcolor=""#c0c0c0""> </td>"
next
do
Dim MB_BJ
If (Date) = (dtDate) Then
MB_BJ = "bgcolor=#CCEE44"
Else
MB_BJ = ""
End If
Response.Write "<td align=center "&MB_BJ&">"
Response.Write "<a href=Events.asp?nMonth="& nMonth &"&nYear="& nYear &"&nDay="&Day(dtDate)&">" & Day(dtDate) & "</a>"
Response.Write "</td>"
if WeekDay(dtDate) = 7 then
Response.Write "</tr>" & vbCrLf & "<tr bgcolor=""#ffffc0"">"
end if
dtDate = DateAdd("d", 1, dtDate)
loop until (Month(dtDate) <> CInt(nMonth))
if Weekday(dtDate) <> 1 then
for nDex = Weekday(dtDate) to 7
Response.Write "<td bgcolor=""#C0C0C0""> </td>"
next
end if
%>
</tr>
</table>
</td>
</tr>

<tr>
<td colspan=2 align="center">
<select name="nYear" class="select" onChange="DateSelect.submit();">
<%
' 注:已将年份设置为 1999 年和 2000 年之间
for nDex = 2000 to Year(Date)+5
Response.Write "<option value=""" & nDex & """"
if nDex = CInt(nYear) then Response.Write " selected"
Response.Write ">" & nDex&" 年"
next
Response.Write "</select> <select name=nMonth class=select onChange='DateSelect.submit();'>"
for nDex = 1 to 12
Response.Write "<option value=""" & nDex & """"
if MonthName(nDex) = MonthName(nMonth) then
Response.Write " selected"
end if
Response.Write ">" & MonthName(nDex)
next %>
</select>

<%
Dim LnMonth,LnYear,RnMonth,RnYear
LnMonth = nMonth-1
LnYear = nYear
RnMonth = nMonth+1
RnYear = nYear
If Request.QueryString("nYear") <> "" Then
If Request.QueryString("nMonth") > 1 Then
LnMonth = (Request.QueryString("nMonth")) - 1
LnYear = (Request.QueryString("nYear"))
ElseIf Request.QueryString("nMonth") = 1 Then
LnMonth = 12
LnYear = (Request.QueryString("nYear")) - 1
End If
End If
If Request.QueryString("nYear") <> "" Then
If Request.QueryString("nMonth") < 12 Then
RnMonth = (Request.QueryString("nMonth")) + 1
RnYear = (Request.QueryString("nYear"))
ElseIf Request.QueryString("nMonth") = 12 Then
RnMonth = 1
RnYear = (Request.QueryString("nYear")) + 1
End If
End If
%>


<input type="button" class="input" style="FONT-FAMILY: 'Wingdings 3'" onclick="location.href='Temp.asp?nYear=<%= LnYear %>&nMonth=<%= LnMonth %>'" value="|" >
<input type="button" class="input" style="FONT-FAMILY: 'Wingdings 3'" onclick="location.href='Temp.asp?nYear=<%= RnYear %>&nMonth=<%= RnMonth %>'" value="}" >
</td>
</tr>
</form>[/QUOTE]
2007-05-31 14:00
快速回复:[求助]如何让数据在指定的表格内显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019144 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved