导航:首页 > 编程语言 > asp日历日程代码

asp日历日程代码

发布时间:2021-12-05 04:16:06

❶ ASP+JS日历源代码

直接保存成 asp文件 运行就可以
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="http://purl.org/dc" rel="schema.DC" />
<title>日历</title
</head>
<body bgcolor="#FFFFFF">
<%
' 要调用的函数声明
'根据年份及月份得到每月的总天数
Function GetDaysInMonth(iMonth, iYear)
Select Case iMonth
Case 1, 3, 5, 7, 8, 10, 12
GetDaysInMonth = 31
Case 4, 6, 9, 11
GetDaysInMonth = 30
Case 2
If IsDate("February 29, " & iYear) Then
GetDaysInMonth = 29
Else
GetDaysInMonth = 28
End If
End Select
End Function
'得到一个月开始的日期.
Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
Dim dTemp
dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function
'得到当前一个月的上一个月.
Function SubtractOneMonth(dDate)
SubtractOneMonth = DateAdd("m", -1, dDate)
End Function
'得到当前一个月的下一个月.
Function AddOneMonth(dDate)
AddOneMonth = DateAdd("m", 1, dDate)
End Function
' 函数声明结束

Dim dDate ' 日历显示的日期
Dim iDOW ' 每一月开始的日期
Dim iCurrent ' 当前日期
Dim iPosition ' 表格中的当前位置

' 得到选择的日期并检查日期的合法性
If IsDate(Request.QueryString("date")) Then
dDate = CDate(Request.QueryString("date"))
Else
If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
Else
dDate = Date()

If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then
Response.Write "您所选择的日期格式不正确,系统会使用当前日期.<BR><BR>"
End If

End If
End If

'得到日期后我们先得到这个月的天数及这个月的起始日期.
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(dDate)

%>
<table width="180" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="150" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"> </td>
</tr>
</table>
<table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" colspan="7"><table border="0" cellpadding="0" cellspacing="0"width="100%">
<tr>
<td height="22" align="right"><a href="rl.asp?date=<%= SubtractOneMonth(dDate) %>"><img src="../images/dot_left.gif" width="15" height="14" border="0" /></a></td>
<td align="center"><font color="999999"><b><%= MonthName(Month(dDate)) & " " & Year(dDate) %></b></font></td>
<td><a href="rl.asp?date=<%= AddOneMonth(dDate) %>"><img src="../images/dot_right.gif" width="15" height="14" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="25" height="22" align="center"><font
color="d08c00"><b>日</b></font> </td>
<td width="25" align="center"><b><font color="999999">一</font></b> </td>
<td width="25" align="center"><b><font color="999999">二</font></b> </td>
<td width="25" align="center"><b><font color="999999">三</font></b> </td>
<td width="25" align="center"><b><font color="999999">四</font></b> </td>
<td width="25" align="center"><b><font color="999999">五</font></b> </td>
<td width="25" align="center"><b><font color="d08c00">六</font></b> </td>
</tr>
<%
' 如果这个月的起始日期不是周日的话就加空的单元.
If iDOW <> 1 Then
Response.Write vbTab & "<TR>" & vbCrLf
iPosition = 1
Do While iPosition < iDOW
Response.Write vbTab & vbTab & "<TD></TD>" & vbCrLf
iPosition = iPosition + 1
Loop
End If

' 绘制这个月的日历
iCurrent = 1
iPosition = iDOW
Do While iCurrent <= iDIM
' 如果是一行的开头就使用 TR 标记
If iPosition = 1 Then
Response.Write vbTab & "<TR>" & vbCrLf
End If

' 如果这一天是我们选择的日期就高亮度显示该日期.
If iCurrent = Day(dDate) Then
Response.Write vbTab & vbTab & "<TD BGCOLOR=#eeeeee height=18 align=center><B>" & iCurrent & "</B></TD>" & vbCrLf
Else
Response.Write vbTab & vbTab & "<TD height=18 align=center><A HREF=""./rl.asp?date=" & Month(dDate) & "-" & iCurrent & "-" & Year(dDate) & """>" & iCurrent & "</A></TD>" & vbCrLf
End If

' 如果满一周的话表格就另起一行
If iPosition = 7 Then
Response.Write vbTab & "</TR>" & vbCrLf
iPosition = 0
End If

iCurrent = iCurrent + 1
iPosition = iPosition + 1
Loop

' 如果一个月不是以周六结束则加上相应的空单元.
If iPosition <> 1 Then
Do While iPosition <= 7
Response.Write vbTab & vbTab & "<TD></TD>" & vbCrLf
iPosition = iPosition + 1
Loop
Response.Write vbTab & "</TR>" & vbCrLf
End If
%>
</table>
<table width="150" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"> </td>
</tr>
</table></td>
</tr>
</table>

❷ asp获取日历形式的时间

你说的是客户端的输入,跟ASP服务端没关系,这个功能用javascript实现的,但代码很复杂的,用控件应该更方便点。jQuery_calendar 这个jQuery插件就可实现你要的功能。基于jQuery的日期插件也很多。你google一下 jQuery calendar 这个关键字会有很多的,希望你能找到你所要的。

❸ 找了一个输入日历的语句,如何嵌入到ASP程序中调用,请教

即代码如下,在form中的 添加action即提交地址的属性,然后添加用户输入框 和 提交按钮。代码如下
。。。。。。。。。}
</SCRIPT>
</HEAD>

<BODY onclick="hiddenCal()">
<form name="form22" method="post" action="search.asp">
开始日期:<INPUT TYPE="TEXT" name="stadate" ONCLICK="showCalendar(this);this.blur();" class="boxinput" onmouseout="calshow=false"/>
结束日期:<INPUT TYPE="TEXT" name="endstate" ONCLICK="showCalendar(this);this.blur();" class="boxinput" onmouseout="calshow=false"/>
<div id="calendar" style="position:absolute;height:140px;width:160px;display:none;border:1px inset #003399;" onmouseover="calshow=true" onmouseout="calshow=false"/>
<input name="stype" type="radio" value="yhxx" > 用户信息

<input type="submit" name="submit" value="查询">
</form>
</BODY>
</HTML>

------
search.asp
--- 取得用户信息 和 起止日期
<%
stadate = Request("stadate")
endstate = Request("endstate")
stype = Request("stype")

%>

❹ 您好,非常喜欢你做的日程日历控件http://.baidu.com/question/233798813.html 能否给予代码参考

cs代码==========================================
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Collections.Generic;
using System.Data;

using NaLong.Model;
using NaLong.DAL;
using NaLong.Web;

/// <summary>
/// 写工作报告页面
/// </summary>
public partial class Diary : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//btnSubmit.Attributes.Add("onclick", "if (typeof(MyObject) != \"undefined\"){MyObject.UpdateEditorFormValue(); return true;}else{return true;}");

if (!Page.IsPostBack)
{
StartDate = new DateTime(Calendar1.TodaysDate.Year, Calendar1.TodaysDate.Month, 1);
GetCurMonthDiarys();
}
}

#region 属性

//操作类型 -1:创建 !-1:编辑
private int Id
{
get { return (int)ViewState["Id"]; }
set { ViewState["Id"] = value; }
}

//当前编辑日期
private DateTime EditDate
{
get { return (DateTime)ViewState["EditDate"]; }
set { ViewState["EditDate"] = value; }
}

/// <summary>
/// 当前月报告列表
/// </summary>
private IDictionary<DateTime, string> DiaryList
{
get { return (IDictionary<DateTime, string>)ViewState["DiaryList"]; }
set { ViewState["DiaryList"] = value; }
}

//当前月的开始日期
private DateTime StartDate
{
get { return (DateTime)ViewState["StartDate"]; }
set { ViewState["StartDate"] = value; }
}

/// <summary>
/// 当前登录用户的姓名
/// </summary>
protected string Name
{
get
{
User user = Session["user"] as User;
return user.Name;
}
}

#endregion

//获取当前月报告列表保存到viewState
private void GetCurMonthDiarys()
{
User user = Session["user"] as User;
DiaryList = DiaryService.GetByMonth(StartDate, StartDate.AddMonths(1), user.Id);
}

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsOtherMonth)
{
e.Cell.Controls.Clear();
}
else
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<a href={0}>", e.SelectUrl);
sb.Append(SetCellAttribute(e.Cell, e.Day));

if (DiaryList.ContainsKey(e.Day.Date))
{
sb.AppendFormat("<p>{0}</p>", DiaryList[e.Day.Date]);
}

sb.Append("</a>");
e.Cell.Text = sb.ToString();
}
}

//设置格子样式和脚本
private string SetCellAttribute(TableCell cell, CalendarDay date)
{
string div = string.Empty;
if (date.IsToday) //今天日期字体加粗背景灰色,整个cell背景黄色
{
div = string.Format("<div class='today'>{0}</div>", date.Date.Day);
cell.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#FFFFCC");
}
else if (date.IsWeekend) //周末
{
div = string.Format("<div class='weekend'>{0}</div>", date.Date.Day);
}
else//平时
{
div = string.Format("<div class='date'>{0}</div>", date.Date.Day);
}

cell.Attributes.Add("onmouseover", "color=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'");
cell.Attributes.Add("onmouseout", "this.style.backgroundColor=color");
return div;
}

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
UpdatePanel2.Update();
GetDiary();
ModalPopupExtender1.Show();
}

private void GetDiary()
{
lblDate.Text = "于" + Calendar1.SelectedDate.ToLongDateString();

User user = Session["user"] as User;
NaLong.Model.Diary diary = DiaryService.Get(Calendar1.SelectedDate, user.Id);
//如果存在这条的则显示信息
if (diary != null)
{
txtTitle.Text = diary.Title;
FCKeditor1.Value = diary.Content;
txtExperience.Text = diary.Experience;

if (diary.Comment.Length > 0) //显示批示
{
trComment.Visible = true;
lblComment.Text = diary.Comment;
}

this.Id = diary.Id;
btnDelete.Visible = true;
}
else
{
txtTitle.Text = string.Empty;
FCKeditor1.Value = string.Empty;
txtExperience.Text = string.Empty;
trComment.Visible = false;

this.Id = -1;
btnDelete.Visible = false;
}

//同时点击一个日期不会引发事件,所以这里每次要另指日期
this.EditDate = Calendar1.SelectedDate;
Calendar1.SelectedDate = Convert.ToDateTime("2000-1-1");
}

protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
//触发VisibleMonthChanged事件后可以获得VisibleDate
StartDate = new DateTime(Calendar1.VisibleDate.Year, Calendar1.VisibleDate.Month, 1);
GetCurMonthDiarys();
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
User user = Session["user"] as User;
NaLong.Model.Diary diary = this.Id == -1 ? new NaLong.Model.Diary() : DiaryService.GetT(this.Id);
diary.TaskId = -1;
diary.Title = txtTitle.Text.Trim();
diary.Content = FCKeditor1.Value;
diary.Experience = txtExperience.Text;
diary.Date = this.EditDate;
diary.SubmitDate = DateTime.Today;
diary.UserId = user.Id;

if (this.Id == -1)
{
DiaryService.Insert(diary);
}
else
{
DiaryService.Update(diary);
}

ModalPopupExtender1.Hide();
UpdatePanel1.Update();
GetCurMonthDiarys();
}

protected void btnDelete_Click(object sender, EventArgs e)
{
User user = Session["user"] as User;
DiaryService.Delete(this.EditDate, user.Id);
UpdatePanel1.Update();
GetCurMonthDiarys();
}

}

aspx页面===============================================================
<%@ Page Language="C#" MasterPageFile="~/UserMaster.master" AutoEventWireup="true"
CodeFile="Diary.aspx.cs" Inherits="Diary" ValidateRequest="false" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<script type="text/javascript" language="javascript">

// Some Class
function MyClass()
{
this.UpdateEditorFormValue = function(val)
{
for ( i = 0; i < parent.frames.length; ++i )
if( parent.frames[i].FCK )
{
parent.frames[i].FCK.UpdateLinkedField();
}
}
}
// instantiate the class
var MyObject = new MyClass();

function Submitting()
{
var title = document.getElementById("<%=txtTitle.ClientID %>");
if(title.value.length==0)
{
alert("请输入标题!");
return false;
}

if (typeof(MyObject) != "undefined")
{
MyObject.UpdateEditorFormValue();
}

setTimeout("document.getElementById('<%=btnSubmit.ClientID %>').setAttribute('disabled','disabled')",1);
return true;
}
</script>

<h3 class="ptitle">
<span>工作报告管理</span>
</h3>
<p class="pextra viewdiary">
<a href="DiaryList.aspx">列表显示方式</a>
</p>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Calendar ID="Calendar1" runat="server" CellPadding="0" Width="100%" OnSelectionChanged="Calendar1_SelectionChanged"
OnDayRender="Calendar1_DayRender" DayNameFormat="Full" FirstDayOfWeek="Monday"
NextMonthText="&gt;&gt;" PrevMonthText="&lt;&lt;" BorderWidth="0px"
OnVisibleMonthChanged="Calendar1_VisibleMonthChanged">
<TitleStyle CssClass="TitleStyle" />
<DayHeaderStyle CssClass="DayHeaderStyle" />
<OtherMonthDayStyle CssClass="OtherMonthDayStyle" />
<DayStyle CssClass="day" />
<WeekendDayStyle CssClass="day" />
</asp:Calendar>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlDiary" runat="server" CssClass="modalPopup" Style="display: none;
width: 750px;">
<table>
<caption>
添加/编辑工作报告<input type="button" onclick="$find('popup').hide()" class="dialogclose" />
</caption>
<tr>
<th>
标题
</th>
<td>
<asp:TextBox ID="txtTitle" runat="server" Width="580px" ToolTip='请填写当天工作的核心内容如:"今天去哪里出差"'></asp:TextBox>
<asp:Label ID="lblDate" runat="server"></asp:Label>
</td>
</tr>
<tr>
<th>
内容
</th>
<td>
<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" Height="300px" ToolbarSet="Simple"
ToolbarStartExpanded="false">
</FCKeditorV2:FCKeditor>
</td>
</tr>
<tr>
<th>
心得
</th>
<td>
<asp:TextBox ID="txtExperience" runat="server" Height="50px" Width="99%"
TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr runat="server" id="trComment">
<th>
批示
</th>
<td>
<asp:Label ID="lblComment" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr class="footer">
<td colspan="2">
<asp:Button ID="btnSubmit" runat="server" Text="保存" CssClass="btn" OnClick="btnSubmit_Click"
OnClientClick="return Submitting()"/>

<asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="btn" Visible="false"
OnClick="btnDelete_Click" OnClientClick='return confirm("您确定要删除该天的工作报告吗?")' />
<input type="button" value="关闭" onclick="$find('popup').hide()" class="btn" />
</td>
</tr>
</table>
</asp:Panel>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlDiary"
TargetControlID="HiddenField1" BackgroundCssClass="modalBackground" BehaviorID="popup">
</asp:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

css样式===================================
/****************** calendar ***********************/

/* 题头月份 table*/
.TitleStyle td
{
background: #C3D9FF;
padding-left: 10px;
}

/* 星期 th*/
.DayHeaderStyle
{
background: #C3D9FF;
text-align: center;
height: 22px;
vertical-align: middle;
font-size: 11px;
line-height: 18px;
font-weight: normal;
}

/* 灰色日期 td*/
.OtherMonthDayStyle
{
border: 1px solid #CCDDEE;
background: #EDEDED;
}

/* 日期格式 */
.day
{
border: 1px solid #CCDDEE;
background: #fff;
height: 70px;
vertical-align: top;
}

.day a
{
text-decoration: none;
font-size: 13px;
display: block;
width: 100%;
height: 100%;
color: #5D5D5E;
}

/* 日期数字 */
.day a div
{
padding: 2px 4px;
text-align: right;
color: #000;
}

/* 日期内容 */
.day a p
{
font: 13px Arial, Helvetica, sans-serif;
text-align: left;
padding: 2px 1px;
line-height: 25px;
margin: 0px;
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
cursor: pointer;
}

.day a .attendancep1
{
font-size: 14px;
text-align: center;
line-height: 22px;
}
.day a .bad
{
color: Red;
}
.day a .attendancep2
{
font-size: 15px;
text-align: center;
line-height: 45px;
}

/* 非周末 */
.day a .date
{
background: #E8EEF7;
}

/* 周末 */
.day a .weekend
{
background: #EFFCC6;
}

.day a .today
{
font-weight: bold;
background: #bbccdd;
}

❺ 用asp做个日历的代码该怎么写,谁知道,可以告诉我吗,

<%
Sub Calendar()

Dim y, m, d
Dim i, j, n, c, w
Dim iEnd

' y, m, d 年 月 日
y = Year(Date())
m = Month(Date())
d = Day(Date())

' n 一年的天数
If y Mod 400 = 0 Or (y Mod 4 = 0 And y Mod 100 <> 0) Then
n = 366
Else
n = 365
End If

' c 当前月的天数
Select Case m
Case 1, 3, 5, 7, 8, 10, 12
c = 31
Case 2
If n = 366 Then
c = 29
Else
c = 28
End If
Case Else
c = 30
End Select

' w 当前月第一天是星期几
w = CInt(Weekday(DateSerial(y, m, 1)))
iEnd = ((w+c-1)\7-CInt((w+c-1)\7<>(w+c-1)/7))*7

Response.Write "<table id=""calendar"">"
Response.Write "<tr><td class=""sunday"">日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>"
For i = 1 To iEnd
If i = 1 Then Response.Write "<tr>"
If i > w-1 And i < w+c Then
If i Mod 7 = 1 Then
Response.Write "<td class=""sunday"">"
Else
Response.Write "<td>"
End If
If i-w+1 = d Then
Response.Write "<span id=""today"" style=""font-weight:bold;"">" & i-w+1 & "</span>"
Else
Response.Write i-w+1
End If
Response.Write "</td>"
Else
Response.Write "<td></td>"
End If
If i Mod 7 = 0 And i <> iEnd Then Response.Write "</tr><tr>"
If i = iEnd Then Response.Write "</tr>"
Next
Response.Write "</table>"
End Sub
%>
<%Calendar()%>

❻ asp源码, 点击日历输入,最好有完整样本,谢谢。

给你个简单的,不过不知是不是你要的

❼ 怎么用ASP写一个日历的程序同时输出access数据表中的数据到对应的日期

网上有关于日历的JS代码,将其插入到你的ASP网页中,此时日历会自动回获取你当前的服务器时间,答此时以ASP程序获取当前服务时间并设立设立条件语句,首先要你的数据库能获取你设定的时间时间,当达到你设定的日期时间时,再以Response.Write("")来输出数据库的值久可以了。

❽ asp日历 急需

www.moon-soft.com/download/sort/46_1.htm
这有源码~你可以自己设置
你是有自己的网站吧?

❾ 谁能发给我一个ASP自动生成日期的代码

<table> <tr>
<td height="60" align="center" valign="middle" class="a1">生日:</td>
<td height="50"><span class="a1">
<select name="yue" id="yue">
<option>~~</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
</span><span class="a1">月</span><span class="a1">
<select name="ri" id="ri">
<option value="~~">~~</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
日</span></td>
</tr>
</table>

阅读全文

与asp日历日程代码相关的资料

热点内容
讲一家三口去护林的电影 浏览:591
网贷如何处理数据 浏览:16
女主强大现代修真文 浏览:317
美容院韩剧电影的名字 浏览:856
韩国电影床戏合集 浏览:983
谁有小电影网站 浏览:459
原油投资口袋期牛app 浏览:819
从u盘中删除的文件去了哪里 浏览:580
樱桃美版女主角是谁 浏览:747
premiere教程pdf 浏览:251
计算机网络技术毕业能干嘛 浏览:587
电影提前看去哪看 浏览:674
印度电影女孩被子撞 浏览:350
主角10岁收了母亲的都市小说 浏览:976
谁有可以看的那种网站啊 浏览:34
男主无敌却隐世的小说 浏览:461
linuxsftp下载文件 浏览:267
快播电影的网址是多少 浏览:842
和尚采阴补阳香港电影 浏览:985
内外网系统如何进行数据交换 浏览:386

友情链接