Avatar billede agm Nybegynder
13. november 2010 - 15:49 Der er 1 kommentar

Ændring i Kalenderscript

Hej - jeg bruger en asp kalender.

Men kunne godt tænke mig uge nr. på og at man kunne bestemme bg farve i cellerne. Nogen der ved hvordan det nemmest kan gøres?

<% REM --------BEGINNING OF DRAW CALENDAR SECTION-------- %>
<% REM This section executes the event query and draws a matching calendar. %>
<%
  Dim iDay, iWeek, sFontColor, dictDte(31,2), intCount
  strSql = "SELECT * FROM calendar WHERE year(dte) = " & year(dtCurViewMonth) &" AND month(dte)= " & month(dtCurViewMonth) & " ORDER BY Day(dte)"
stryear = "select * FROM yearlycal Where month(dte)= " & month(dtCurViewMonth) & " ORDER BY Day(dte)"
    set rsyearly = my_conn.execute (stryear)
  set rs = my_conn.Execute (StrSql)
      intCount= 0
      ' populate array with days of month
  do until rs.EOF or intCount = 31
    if Day(rs("dte")) = intCount + 1 then
                dictDte(intCount, 1) = rs("text_field")&"<br>"
        rs.Movenext       
    End If
    'dictDte(intCount, 2) = intCount + 1
    intCount = intCount + 1
  loop
  rs.close

intCount= 0
    ' populate array with days of month
  do until rsyearly.EOF or intCount = 31
    if Day(rsyearly("dte")) = intCount + 1 then
                dictDte(intCount, 1) = dictDte(intCount, 1)&"<font color=#FFFF00>"&rsyearly("yearlyevents")&"</font><br>"
                'response.write dictDte(intCount, 1)
        rsyearly.Movenext       
    End If
    'dictDte(intCount, 2) = intCount + 1
    intCount = intCount + 1
  loop
  rsyearly.close


%>
<html>
<head>
<title>Web Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body text="#000000" link="#FFFFFF" vlink="#FFFFFF" bgcolor="#FFFFFF">
<p align="center"><a href="mailto:stefan@fckbanden.dk"><font color="#0000FF"><br>
  </font></a> <table CELLPADDING="3" CELLSPACING="0" WIDTH="100%" BORDER="2" BGCOLOR="#000099" bordercolordark="#1C644C" bordercolor="#000099" bordercolorlight="#FFFFFF">
<tr VALIGN="MIDDLE" ALIGN="CENTER"> <form NAME="fmNextPrev" ACTION="index.asp" METHOD="POST">
  <input type="hidden" name="CURDATE" value="<%=dtCurViewMonth%>">
  <table CELLPADDING="3" CELLSPACING="0" WIDTH="79%" BORDER="2" BGCOLOR="#99CCFF" BORDERCOLORDARK="#003399" BORDERCOLORLIGHT="#FFFFFF">
    <tr VALIGN="MIDDLE" ALIGN="CENTER">
          <td WIDTH="30%" ALIGN="RIGHT"><input TYPE="image" NAME="subPrev" SRC="Left.gif" BORDER="0" WIDTH="18" HEIGHT="20" HSPACE="0" VSPACE="0"> </td>
          <td WIDTH="40%"><font FACE="Arial" COLOR="#000000"><b><%=MonthName(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%></b> </font></td>
          <td WIDTH="30%" ALIGN="LEFT" colspan="7"><input TYPE="image" NAME="subNext" SRC="Right.gif" BORDER="0" WIDTH="18" HEIGHT="20" HSPACE="0" VSPACE="0"> </td>
       
        </tr>
      </table>
  <table width="79%">
    <tr VALIGN="TOP" ALIGN="CENTER" BGCOLOR="#000099">
<% For iDay = vbSunday To vbSaturday %>
      <th WIDTH="14%"><font FACE="Arial" SIZE="-2" COLOR="#FFFFFF"><%=WeekDayName(iDay)%></font></th>
<%Next %>
    </tr>
<%
  dtCurViewDay = DtPrevSunday(dtCurViewMonth)
 
  For iWeek = 0 To 5
      Response.Write "<TR VALIGN=TOP>" & vbCrLf

Dim sBGCOLOR
sBGCOLOR = "#99ccff"


For iDay = 0 To 6
sBGCOLOR = "#003399"
If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then sBGCOLOR = "#99ccff"
else
sBGCOLOR = "#003399"

End If
Response.Write "<TD HEIGHT=50 bgcolor='" & sBGCOLOR & "' >"
       
     
  If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
        If dtCurViewDay = dtToday Then
              sFontColor = "#00FF00<i></i>"

            Else
              sFontColor = "#00FF00"
            End If
     
        '---- Write day of month
            Response.Write "<FONT FACE=""Arial"" SIZE=""-2"" COLOR=""" & sFontColor & """><B>"
            Response.Write "<a href=view_day.asp?" & "view_date=" & day(dtCurViewday) & "-" & monthname(month(dtCurViewday)) & "-"&Year(dtCurViewMonth)&" style=""text-decoration: none"">"  & Day(dtCurViewDay) & "</B><font color='"&sfontcolor&"'><br>" & formatStr(dictDte(Day(dtCurViewDay)- 1, 1)) & "</a></FONT><BR>"
        '---Else
            '---Response.Write " "
        End If

        Response.Write "&nbsp</TD>" & vbCrLf
        dtCurViewDay = DateAdd("d", 1, dtCurViewDay)
      Next
      Response.Write "</TR>" & vbCrLf
  Next
%>
<%REM --------END OF DRAW CALENDAR SECTION--------
Avatar billede hnteknik Novice
15. november 2010 - 18:52 #1
Her er så et par forslag:

ugenr
<%@LANGUAGE = "JSCRIPT" LCID=1030%>
<TD vAlign=top><strong><% if (eval(_Dato.getDay())==1 || dag == 1) Response.Write(ugenummer (dag,M-1,Y))%></strong></TD>

                        <%  var kaldato=new Date(Y, M-1, 1)
                          var mde = ["Januar","Februar","Marts","April","Maj","Juni","Juli","August","September","Oktober","November","December"];
                          var uge = ["Sø", "Ma", "Ti", "On", "To", "Fr", "Lø"];
                            function DaysInMonth(Month, Year) {
                              var _Date = new Date(Year, Month, 1)
                              var _LastDate = new Date()
                              _LastDate = new Date(_Date)
                              _LastDate.setMonth(_Date.getMonth() + 1)
                              _LastDate.setHours(_LastDate.getHours() - 24)
                              return( _LastDate.getDate())
                            }
                            function yday(y,m,d) {
                          // d = 1..31, m = 0..11, y = xxxx
                          var yd = d + daysInPastMonths[m];
                          if (m > 1) {
                            if (y %  4 == 0) yd++;
                            if (y % 100 == 0) yd--;
                            if (y % 400 == 0) yd++;
                              }
                          return yd;
                          }
                         
                            var daysInPastMonths = new Array(0,31,59,90,120,151,181,212,243,273,304,334);
                         
                          function ugenummer (d,m,y) {
                              var t,wd,yd,thisThursday,week,nY,pY;
                              // d:1..31 m:0..11 y:fircifret årstal
                              //#en dag har samme ugenr som torsdagen i samme uge
                              t = new Date (y,m,d);
                              wd = t.getDay();
                              yd = yday(y,m,d);
                              if (wd == 0) wd = 7;
                              d = d + 4 - wd;
                              yd = yd + 4 - wd;
                              nY = (m == 11); if (nY) nY = (d > 31);
                              pY = (m ==  0); if (pY) pY = (d <  1);
                              if (nY) {
                                m= 0; d= d-31; y++; 
                                yd = yday(y,m,d);
                              } else if (pY) {
                                m=11; d= d+31; y--; 
                                yd = yday(y,m,d);
                              }
                              thisThursday = yd;
                              t = new Date (y,0,1);
                              wd = t.getDay();
                              yd = yday(y,0,1);
                              if (wd > 4) wd = wd - 7;
                              yd = yd + 4  - wd;
                              week = (thisThursday - yd) / 7 + 1;
                              return week;
                          }

                            var nodays = DaysInMonth(kaldato.getMonth(), kaldato.getYear())
                            var _Dato = kaldato;
                            var ugedag;
                          %>

--------
farvevisning styres med klasser - se foreks. idag og endag :

<TR class=idag style="CURSOR: hand" onclick=d150.click() >
                                        <TD class="clrweekday1" vAlign=top align=left>Ma</TD>
                                        <TD vAlign=top align=right><strong><A class=neutral name=d150 href="java script:dato(0,'15-11-2010',0,0,0,0,0,0)">
                                          15
                                          &nbsp;</A></strong></TD>
                                        <TD vAlign=top>&nbsp;</TD>
                                        <TD align="right" vAlign=top class=neutral><strong>
                                    46
                                          &nbsp;</strong></TD>
                                        <TD vAlign=top><IMG height=10 alt="Varsel pr. e-mail" hspace=2 src="img/spacer.gif" width=11 vspace=2 border=0></TD>
                                      </TR>
                                   
                                      <TR bgColor=black>
                                        <TD colSpan=5><IMG height=1 src="img/spacer.gif"></TD>
                                      </TR>
                               
                                      <TR class=endag style="CURSOR: hand" onclick=d160.click() >
                                        <TD class="clrweekday2" vAlign=top align=left>Ti</TD>
                                        <TD vAlign=top align=right><strong><A class=neutral name=d160 href="java script:dato(0,'16-11-2010',0,0,0,0,0,0)">
                                          16
                                          &nbsp;</A></strong></TD>
                                        <TD vAlign=top>&nbsp;</TD>
                                        <TD align="right" vAlign=top class=neutral><strong>
                                   
                                          &nbsp;</strong></TD>
                                        <TD vAlign=top><IMG height=10 alt="Varsel pr. e-mail" hspace=2 src="img/spacer.gif" width=11 vspace=2 border=0></TD>
                                      </TR>
--------

}
.idag {
    FONT-SIZE: 10px;
    COLOR: #FFFFFF;
    FONT-FAMILY: Verdana;
    background-color: #E7E7E7;
}
.endag {
    FONT-SIZE: 10px; BACKGROUND: #FFFFFF; COLOR: #000000; FONT-FAMILY: Verdana
}
Avatar billede Ny bruger Nybegynder

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.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



IT-JOB

Cognizant Technology Solutions Denmark ApS

Energy Trading Project Manager – Consulting

Udviklings- og Forenklingsstyrelsen

Teknisk tester der brænder for automatisering

Arbit Cyber Defence Systems ApS

Compliance Specialist