Avatar billede a55830 Praktikant
17. november 2004 - 13:58 Der er 2 kommentarer og
1 løsning

Kalender til begivenheder

Hej ASP hajer

ja så er jeg på den igen 

jeg skal bruge en kalender hvor der er en der skriver iden og alle andre kan se det og ikke rette/tilføje

den skal hente event fra en database kan man finde det som freeware eller er der en af jer der hvil hjælpe mig med en stump kode
Avatar billede a55830 Praktikant
18. november 2004 - 09:06 #1
hej med jer jeg har nu fundet en noget kode til en kalender og jeg håber at der er en af jeg der kan hjælpe mig med at lave den om til at jeg henter oplysninger fra en databasen og at der er mærke på den dag hvor der er en event bag.

Er det noget i kan hjælpe med

her er koden ( www.blueeye.dk/calender.asp)

<%@ language=vbscript%>
<%option explicit%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function month_onchange()
{
form1.submit();
}

function year_onchange()
{
form1.submit();
}

//-->
</SCRIPT>
</HEAD>
<BODY bgcolor=LightSkyBlue>

<style>
a
{
  .color="mediumblue"
}
</style>

<form name=form1 action=calendar.asp method=post>
<%
dim change_month
dim change_year
dim diff_days
dim diff_months
dim diff_years
diff_days=0
diff_months=0
diff_years=0

change_month=Request.Form("month")
change_year=Request.Form("year")

if change_month="" then
  change_month=month(date())
end if

if change_year="" then
  change_year=year(date())
end if

%>
<br><br>

<table>
<tr>
  <td>
  <select name=month LANGUAGE=javascript onchange="return month_onchange()">
    <option value="1" <% if change_month="1" then%> selected <%end if%>>January</option>
    <option value="2" <% if change_month="2" then%> selected <%end if%>>Febuary</option>
    <option value="3" <% if change_month="3" then%> selected <%end if%>>March</option>
    <option value="4" <% if change_month="4" then%> selected <%end if%>>April</option>
    <option value="5" <% if change_month="5" then%> selected <%end if%>>May</option>
    <option value="6" <% if change_month="6" then%> selected <%end if%>>June</option>
    <option value="7" <% if change_month="7" then%> selected <%end if%>>July</option>
    <option value="8" <% if change_month="8" then%> selected <%end if%>>August</option>
    <option value="9" <% if change_month="9" then%> selected <%end if%>>September</option>
    <option value="10" <% if change_month="10" then%> selected <%end if%>>October</option>
    <option value="11" <% if change_month="11" then%> selected <%end if%>>November</option>
    <option value="12" <% if change_month="12" then%> selected <%end if%>>December</option>
  </select>
  </td>
 
  <td>
  <select name=year LANGUAGE=javascript onchange="return year_onchange()">
    <%dim year_display%>
    <%for year_display=2003 to 2005%>
      <option value=<%=year_display%> <% if int(change_year)=year_display then%> selected <%end if%>><%=year_display%></option>
    <%next%>
    <!-- <option value="2003" <% if change_year="2003" then%> selected <%end if%>>2003</option>
    <option value="2004" <% if change_year="2004" then%> selected <%end if%>>2004</option>
    <option value="2005" <% if change_year="2005" then%> selected <%end if%>>2005</option>
    <option value="2006" <% if change_year="2006" then%> selected <%end if%>>2006</option>
    <option value="2007" <% if change_year="2007" then%> selected <%end if%>>2007</option>
    <option value="2008" <% if change_year="2008" then%> selected <%end if%>>2008</option>
    <option value="2009" <% if change_year="2009" then%> selected <%end if%>>2009</option>
    <option value="2010" <% if change_year="2010" then%> selected <%end if%>>2010</option>
    <option value="2011" <% if change_year="2011" then%> selected <%end if%>>2011</option>
    <option value="2012" <% if change_year="2012" then%> selected <%end if%>>2012</option>
    <option value="2013" <% if change_year="2013" then%> selected <%end if%>>2013</option>
    <option value="2014" <% if change_year="2014" then%> selected <%end if%>>2014</option>-->
  </select>
  </td>
</tr>
</table>
 
<%
dim temp
dim total_days
dim m
dim month_name
dim next_month_name
dim y
dim to_day
dim first_day
dim first_day_month
dim week_day
dim sys_m
dim sys_y
dim mode_check'SELECT DATE IS LESS THAN SYSTEM DATE

dim i
dim j
dim dat
dim state
dat=1
state=1

m=int(change_month)
month_name=ucase(monthname(m))

y=int(change_year)

sys_m=month(date())
sys_y=year(date())

dim count_months
dim count_years
count_months=0
count_years=0

if y<sys_y then
diff_years=sys_y-y
  'if m>=sys_m then
      diff_months=((diff_years -1)*12)+(12-m)+sys_m
      do while diff_years>count_years
        sys_y=y
        sys_m=m
        do while diff_months>count_months
          call get_days(sys_m)
          sys_m=sys_m+1
          if sys_m=13 then
            sys_m=1
            count_years=count_years+1
            sys_y=sys_y+1
          end if
          count_months=count_months+1
        loop
      loop
      mode_check="less" 
      'Response.Write(diff_days)

else if y=sys_y then

  if m>sys_m then
    do while m>sys_m
      call get_days(sys_m)
      sys_m=sys_m+1
    loop
  else
    diff_months=sys_m-m
    sys_m=m
    do while diff_months>count_months
      call get_days(sys_m)
      sys_m=sys_m+1
      count_months=count_months+1
    loop
    mode_check="less"
  end if 'M>SYS_M

else

  diff_years=y-sys_y
  do while diff_years>count_years
    if m>=sys_m then
      diff_months=(diff_years*12)+m-sys_m 
      do while diff_months>count_months
        call get_days(sys_m)
        sys_m=sys_m+1
        if sys_m=13 then
          sys_m=1
          count_years=count_years+1
          sys_y=sys_y+1
        end if
        count_months=count_months+1
      loop
   
    else
      diff_months=((diff_years-1)*12)+(12-sys_m)+m
      do while diff_months>count_months
        call get_days(sys_m)
        sys_m=sys_m+1
        if sys_m=13 then
          sys_m=1
          count_years=count_years+1
          sys_y=sys_y+1
        end if
        count_months=count_months+1
    loop
   
    end if
   
  loop
 
end if 'Y=SYS_Y
end if

'Response.Write(diff_days)

to_day=day(date())
week_day=weekday((date()))'IT RETURNS WEEKDAY NO.1-SUNDAY
 
call get_month(m)

first_day=((diff_days-to_day)mod 7+week_day +1)mod 7

if mode_check="less" then
  first_day=week_day-(diff_days+to_day) mod 7 +1
  if first_day<0 then
    first_day=7+first_day
  end if
end if
   
if first_day <0 then
    first_day_month=week_day-first_day
    else if first_day=0 then
        first_day_month=7
    else
        first_day_month=first_day
    end if
end if

%>

<br><br>

<table bgcolor=DarkBlue>
<font color=MediumBlue><%=month_name%>    <%=y%> </font>
</table> 

<table width=30% cellspacing=10><!--FIRST MONTH STARTS FROM HERE-->
<tr>
  <td><font color=Red>Sun</font></td>
  <td><font color=MediumBlue>Mon</font></td>
  <td><font color=MediumBlue>Tue</font></td>
  <td><font color=MediumBlue>Wed</font></td>
  <td><font color=MediumBlue>Thu</font></td>
  <td><font color=MediumBlue>Fri</font></td>
  <td><font color=MediumBlue>Sat</font></td>
</tr>

<tr>
  <td colspan=7>
  <hr>
  </td>
</tr>

<%for j=1 to 6%>
<tr>
  <%if state=2 then%>
  <%for i=1 to 7%>
  <td align=center>
  <a href="calendar12.asp"><%=dat%></a>
  </td>
  <%dat=dat+1%>
 
  <%if dat>total_days then%>
  <%state=3
    exit for%>
  <%end if%>
 
  <%next%>
  <%end if%>
 
  <%if state=1 then%>
  <%for i=1 to first_day_month-1%>
  <td>
  </td>
  <%next%> 
  <%for i=first_day_month to 7%>
  <td align=center>
  <a href="calendar12.asp"><%=dat%></a>
  </td>
  <%dat=dat+1%>
  <%next%>
  </td>
  <%state=2%>
  <%end if%>
 
</tr>
<%next%>

<tr>
<td colspan=7>
  <hr>
</td>
</tr>

</table><!--FIRST MONTH ENDS HERE-->


<!--<%
m=m+1
if m=13 then
  m=1
  y=y+1
end if
%>

<%next_month_name=ucase(monthname(m))%>

<font color=Blue><%=next_month_name%>&nbsp;&nbsp;&nbsp;&nbsp;<%=y%> </font>

<table width=35%>-->  <!--SECOND MONTH STARTS FROM HERE-->
<!--<%call get_month(m)%>

<%
if i=7 then
  i=1
else
  i=i+1
end if
first_day_month=i
state=1
dat=1
%>
<tr>
  <td>SUN</TD>
  <td>MON</TD>
  <td>TUE</TD>
  <td>WED</TD>
  <td>THU</TD>
  <td>FRI</TD>
  <td>SAT</TD>
</tr>

<%for j=1 to 6%>
<tr>
  <%if state=2 then%>
  <%for i=1 to 7%>
  <td>
  <%=dat%>
  </td>
  <%dat=dat+1%>
 
  <%if dat>total_days then%>
  <%state=3
    exit for%>
  <%end if%>
 
  <%next%>
  <%end if%>
 
  <%if state=1 then%>
  <%for i=1 to first_day_month-1%>
  <td>
  </td>
  <%next%> 
  <%for i=first_day_month to 7%>
  <td>
      <%=dat%>
  </td>
  <%dat=dat+1%>
  <%next%>
  </td>
  <%state=2%>
  <%end if%>
 
</tr>
<%next%>

<%for j=1 to 16%>
<tr>
</tr>
<%next%>

</table>--><!--SECOND MONTHS ENDS HERE-->


<%
sub get_month(int)'TO GET NO. OF DAYS IN PARTICULAR MONTH
if m=4 or m=6 or m=9 or m=11 then
    total_days=30
    'Response.Write(total_days)
    else if m=2 and (y mod 4)=0 then
        total_days=29
        'Response.Write(total_days)
        else if m=2 and (y mod 4)<>0 then
            total_days=28
            'Response.Write(total_days)
            else if m=1 or m=3 or m=5 or m=7 or m=8 or m=10 or m=12 then
                total_days=31
                'Response.Write(total_days)
            end if
        end if
    end if
end if
end sub

sub get_days(int)'TO GET NO. OF DAYS IN PARTICULAR MONTH
if sys_m=4 or sys_m=6 or sys_m=9 or sys_m=11 then
    diff_days=diff_days+30
    'Response.Write(diff_days)
    else if sys_m=2 and (sys_y mod 4)=0 then
        diff_days=diff_days+29
        'Response.Write(diff_days)
        else if sys_m=2 and (sys_y mod 4)<>0 then
            diff_days=diff_days+28
            'Response.Write(diff_days)
            else if sys_m=1 or sys_m=3 or sys_m=5 or sys_m=7 or sys_m=8 or sys_m=10 or sys_m=12 then
                diff_days=diff_days+31
                'Response.Write(diff_days)
            end if
        end if
    end if
end if
end sub

%>


</form>

<P> </P>
</BODY>
</HTML>
Avatar billede a55830 Praktikant
18. november 2004 - 10:19 #2
HEHEHEHE har fundet den perfekte

men ok opretter nyt spørgsmål
Avatar billede a55830 Praktikant
18. november 2004 - 10:20 #3
og lige for en god ordens skyld

her er linket jeg fandt den på
http://www.asp-dev.com/main.asp?page=85
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