03. maj 2005 - 20:35Der er
2 kommentarer og 1 løsning
en kalender til at vælge dato
Dette script viser ikke rigtige datoer, er der en som kan gennemsmue hvad er galt?
<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
Øhh... <SCRIPT language=vbscript> er det JS??? ;-| I dine TD's kalder du java script:etellerandet. Er det ikke vbscript: cmonth(x)? (gætter bare :-D) I din <TABLE class="cal" bgColor=black cellPadding=0 cellSpacing=0 height=120> vil jeg på det kraftigste råde dig til at bruge anførselstegn, selv om det er numre, f.eks. <TABLE class="cal" bgColor="black" cellPadding="0" cellSpacing="0" height="120">
Det virkede ikke desværre, jeg poster hele dokumentet så du selv kan se at man tirs ons osv. passer ikke med datoer resten er ok.
<!-- #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><%= navn %></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")="" 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">
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
tidnu = myDay & "/" & myMonth & " " & year(now)
if rs.EOF then Response.write "<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>" else Do Until rs.EOF
%> <% if RS("Aflyst") = "Nej" then status = "" elseif RS("Aflyst") = "Ja" then status = "AFLYST ! " end if %> </font></p> </td> </tr> </table> </div> <center>
Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("kalender.mdb") strSQL = "Select * 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
tidnu = myDay & "/" & myMonth & " " & year(now)
if rs.EOF then Response.write "<font face=""Tahoma"" size=""2""><i><br>Der er ingen kommende arrangementer i kalenderen endnu !!<br><br></i></font>" else Do Until rs.EOF
%> <% 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">
<p><font color="#000000" face="Tahoma"><% elseif Request.QueryString("submode")="save" then %> <%
myDay = Day(Date) If Len(myDay) = 1 Then myDay = "0" & myDay
myMonth = Month(Date) If Len(myMonth) = 1 Then myMonth = "0" & myMonth
mydate = Year(Date) & "" & myMonth & "" & myDay
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
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.