02. oktober 2001 - 15:09Der er
16 kommentarer og 1 løsning
Asp kalender
Jeg har fundet en god asp kalender på nettet, men der er en ting som jeg gerne vil have rettet i den. Den har en funktion hvor den viser dagen idag, og så skal man trykke for at se hvad der sker de kommende dage. Kan det laves så den viser alle dagene på engang...? Scriptet kan downloades på http://62.243.13.234/zybe/kalender.zip
Her er mit forslag, kopier koden ind i filen kalender.asp:
<!-- #include file=\"config.asp\" --> <% response.buffer = true %> <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> <meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\"> <title>Events</title> <style type=text/css> TABLE.cal { COLOR: #c0c0c0; WIDTH: 200px } TD.cal { FONT-FAMILY: tahoma; FONT-SIZE: 12pt; TEXT-ALIGN: center } INPUT.cal { COLOR: white; BACKGROUND: black; BORDER: none; WIDTH: 20 } A { TEXT-DECORATION: none; } A.cal:link { COLOR: white; } A.cal:visited { COLOR: white; } A.cal:active { COLOR: white; } A.cal:hover { COLOR: gray; } A.tdy:link { COLOR: #c5f9c5; } A.tdy:visited { COLOR: #c5f9c5; } A.tdy:active { COLOR: white; } A.tdy:hover { COLOR: gray; } A.tdz:link { COLOR: yellow; FONT-WEIGHT: bold; } A.tdz:visited { COLOR: yellow; FONT-WEIGHT: bold; } #ppcalendar { LEFT: 116px; POSITION: absolute; TOP: 100px } #pcmonth { LEFT: 116px; POSITION: absolute; TOP: 100px } </style> </head> <body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#C0C0C0\" vlink=\"#C0C0C0\" alink=\"#C0C0C0\"> <SCRIPT language=vbscript> function mlookup(mnt) select case mnt case 1 mlookup=\"J A N\" case 2 mlookup=\"F E B\" case 3 mlookup=\"M A R\" case 4 mlookup=\"A P R\" case 5 mlookup=\"M A J\" case 6 mlookup=\"J U N\" case 7 mlookup=\"J U L\" case 8 mlookup=\"A U G\" case 9 mlookup=\"S E P\" case 10 mlookup=\"O K T\" case 11 mlookup=\"N O V\" case 12 mlookup=\"D E C\" end select end function
function mlookup2(mnt) select case mnt case 1 mlookup2=\"Januar\" case 2 mlookup2=\"Februar\" case 3 mlookup2=\"Marts\" case 4 mlookup2=\"April\" case 5 mlookup2=\"Maj\" case 6 mlookup2=\"Juni\" case 7 mlookup2=\"Juli\" case 8 mlookup2=\"August\" case 9 mlookup2=\"September\" case 10 mlookup2=\"Oktober\" case 11 mlookup2=\"November\" case 12 mlookup2=\"December\" end select end function
function yformat(yyr) for a=1 to len(yyr) b=b+mid(yyr,a,1)+\" \" next yformat=mid(b,1,len(b)-1) end function
function dlookup(mm, yy) dlookup=31 if mm<8 and mm/2=fix(mm/2) then dlookup=30 if mm>7 and mm/2<>fix(mm/2) then dlookup=30
if mm=2 then lpyr=leapyear(yy) if lpyr=1 then dlookup=29 if lpyr=0 then dlookup=28 end if end function
function leapyear(yyr) leapyear=0 if yyr/4=fix(yyr/4) then leapyear=1 if yyr/100=fix(yyr/100) then leapyear=0 if yyr/400=fix(yyr/400) then leapyear=1 end function
function namedate2(mmddyy) ddate=mmddyy yys=mid(ddate,1,4) mms=mid(ddate,5,2) dds=mid(ddate,7,2) * 1 ndate=mlookup2(mms) & \" \" & dds & \", \" & yys namedate2=ndate end function
sub init() document.all.mm.value=month(now()) document.all.yy.value=year(now()) document.all.dd.value=day(now()) call pcalendar() end sub
for a=1 to 6 \' six weeks for b=1 to 7 \' seven days c=c+1 if c>=fday then d=d+1 else d=0 end if targetId=a & b if d<=lday then if d=day(now()) and int(mnt)=month(now()) and int(yyr)=year(now()) then innerHTML=\"<a class=\'tdz\' \" else innerHTML=\"<a class=\'cal\' \" end if innerHTML=innerHTML & \"href=\'java script: outday(\" & d & \")\'> \" & d & \" </a>\" if d=0 then innerHTML=\"\" document.all(targetId).innerHTML=innerHTML else document.all(targetId).innerHTML=\"\" end if next fday=1 next end sub
sub prevyr() showpcmonth() document.all.yy.value=document.all.yy.value-1 call pcalendar() end sub
sub nextyr() showpcmonth() document.all.yy.value=document.all.yy.value+1 call pcalendar() end sub
sub prevmo() showpcal() document.all.mm.value=document.all.mm.value-1 if document.all.mm.value=0 then document.all.mm.value=12 document.all.yy.value=document.all.yy.value-1 end if call pcalendar() end sub
sub nextmo() showpcal() document.all.mm.value=document.all.mm.value+1 if document.all.mm.value=13 then document.all.mm.value=1 document.all.yy.value=document.all.yy.value+1 end if call pcalendar() end sub
sub outday(dd) mms=document.all.mm.value yys=document.all.yy.value dds=document.all.dd.value doutid= yys & right(\"0\" & mms, 2) & right (\"0\" & dd,2) dout= right (\"0\" & dd,2) & \"/\" & right(\"0\" & mms, 2) & \" \" & yys dtgo=document.all.cinput.value document.all(dtgo).value=dout if dtgo = \"tdat1\" then document.all(\"idfelt\").value=doutid end if call hidePCal() end sub
sub showPCalE(ddd) ddate=document.all(ddd).value ddateid=dontidfelt yys=year(ddate) mms=month(ddate) dds=day(ddate)
if yys-document.all(\"yy\").value<>0 or mms-document.all(\"mm\").value<>0 then document.all(\"yy\").value=yys document.all(\"mm\").value=mms pcalendar() end if
showPCal() document.all(\"cinput\").value=ddd end sub
sub cmonth(mnt) document.all.mm.value=mnt hidePCmonth() call pcalendar() end sub
sub showPCmonth() document.all(\"pcmonth\").style.display=\"\" end sub
sub hidePCmonth() showpcal() document.all(\"pcmonth\").style.display=\"none\" end sub
sub showPCal() document.all(\"ppcalendar\").style.display=\"\" end sub
sub hidePCal()
document.all(\"ppcalendar\").style.display=\"none\" document.all(\"pcmonth\").style.display=\"none\" end sub
</SCRIPT>
<div align=\"center\"><center>
<% if Request.QueryString(\"submode\")=\"\" OR Request.QueryString(\"submode\")=\"today\" then %> <% myDay = Day(Date) If Len(myDay) = 1 Then myDay = \"0\" & myDay
myMonth = Month(Date) If Len(myMonth) = 1 Then myMonth = \"0\" & myMonth %> <div align=\"center\">
<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"80%\"> <tr> <td width=\"100%\" align=\"center\"> <p align=\"center\"><font face=\"Tahoma\" color=\"#000000\" size=\"5\"><b><%= Navn %></b></font><a href=\"kalender.asp?submode=add\"><font size=\"1\" face=\"Tahoma\" color=\"#000000\"><br> </font></a><font size=\"1\" face=\"Tahoma\" color=\"#000000\"> <br></font> <% if Request.QueryString(\"submode\")=\"today\" then %> <a href=\"kalender.asp\"><b><font color=\"#000000\" face=\"Tahoma\" size=\"2\"><u>Tryk her for at se listen over alle dage !!</u></font></b></a></p> <% else %> <a href=\"kalender.asp?submode=today\"><b><font color=\"#000000\" face=\"Tahoma\" size=\"2\"><u>Tryk her for kun at se listen over idag dage !!</u></font></b></a></p> <% end if %> <!--</center>--> <p align=\"center\"><font color=\"#000000\" face=\"Tahoma\" size=\"1\"><br> <b>Dagen i dag:</b> <% idtid = year(now) & \"\" & myMonth & \"\" & myDay
Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath (\"kalender.mdb\") strSQL = \"Select top 10 * From kalender WHERE eventtid = \" & idtid & \" ORDER BY eventtid\" set rs = Conn.execute(strSQL)
myDay = Day(Date) If Len(myDay) = 1 Then myDay = \"0\" & myDay
myMonth = Month(Date) If Len(myMonth) = 1 Then myMonth = \"0\" & myMonth
if rs.EOF then \'Response.write \"<br><br><center><font face=\"\"Tahoma\"\" size=\"\"2\"\"><i>Der er ingen events i dag !!<br>Se listen over de kommende dage !!<br><br></i></font>\" Response.write \"<br><br><center><font face=\"\"Tahoma\"\" size=\"\"2\"\"><i>Der er ingen events i dag !!<br><br></i></font>\" %> </td> </tr> </table> </div> <% else Do Until rs.EOF
%> <br><br> <% if RS(\"Aflyst\") = \"Nej\" then status = \"\" elseif RS(\"Aflyst\") = \"Ja\" then status = \"AFLYST ! \" end if %> </font></p> </td> </tr> </table> </div>
if rs.EOF then Response.write \"<font face=\"\"Tahoma\"\" size=\"\"2\"\"><i><br><br>Der er ingen kommende events i kalenderen endnu !!<br><br></i></font>\" else Do Until rs.EOF
%> <br> <br> <% if RS(\"Aflyst\") = \"Nej\" then status = \"\" elseif RS(\"Aflyst\") = \"Ja\" then status = \"AFLYST ! \" end if %> </font></p> </td> </tr> </table> </div> <div align=\"center\">
<script language=vbscript> sub ck(xt) k=document.all(xt).value document.all(xt).value=formatdatetime(\"11-12-1999\",2) end sub </script> <form action=\"kalender.asp?submode=save\" method=\"POST\">
if Request.form(\"tdat2\") = Request.form(\"tdat1\") then tildatoen = \" \" elseif Request.form(\"tdat2\") < Request.form(\"tdat1\") then tildatoen = \" \" else tildatoen = \" til den \" & Request.form(\"tdat2\") end if
prøv mnk@wiegaarden.dk, hvis nogen har et godt kalender system i ASP
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.