Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    asp calendar problem

    i create a calendar with weeks and month view and in the top of this calendar i create text box.when any date write in this text box the calendar is automatically update, now my problem is that i need when any date click in month view that date is automatically print in that text box.
    i want that when any date is selected this date is write in this text box. . . .
    plz guide me and send me the coding. . .
    Thanks in advance.
    shaker Aman new asp student

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 Posts
    I think you need to show us the code you have already so we can tell you what to add.

    It is possible that you can do this all in JavaScript code, in HTML, without changing your ASP code. I can't tell from your description.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    calendar problem

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <!-- **************** js ********** -->
    
    <link rel="stylesheet" href="style1.css" type="text/css" media="screen" />
    
    
    <!--
    <form id="jform" action="">
    		
    
    	Date:<input type="text" name="first" id="first" value="<%=sDate%>" /><pre>         (mm-dd-yyyy)</pre>
    <br/><button type="submit" id="send" >submit</button>
    </form>-->
        
    
    
    <script type="text/javascript" src="jQuery.js" charset="utf-8"></script>
    
    <script type="text/javascript" src="function.js" charset="utf-8"></script>
    <!-- ************************* end **************************** -->
    <%
    dim sDate, currWeekDay, offsetWeekDay, firstWeekDate, endWeekDate, row,arrweekdayname
    sDate = request.Form("first")
    'Response.Write(sDate & "<BR>")
    if len(sDate) = 0 then
    	sDate = date
    	
    end if
    sDate = CDate(sDate)
    %>
    
    <!--<form action="maincopy.asp" method="post">
    Date: <input type="text" name="txtDate" id="txtDate" value="<%=sDate%>" /> &nbsp;&nbsp;&nbsp;(date formate i.e. mm/dd/yyyy) <br />
    <input type="submit" name="btnSubmit" id="btnSubmit" title="Click Here to enter any Day" value="Submit" />
    </form>-->
    <form id="jform" action="maincopy1.asp" method="post">
    		
    
    	Date:<input type="text" name="first" id="first" value="<%=sDate%>" /><pre>(mm-dd-yyyy)</pre>
    <br/><button type="submit" id="send" >submit</button>
    </form>
    
     
    <!--<a href="htmlfile.asp">html</a>-->
    <%
    currWeekDay = weekday(sDate)
    offsetWeekDay = 2 - currWeekDay
    firstWeekDate = DateAdd("d", offsetWeekDay,sDate)
    response.Write("<BR>" & weekday(sDate))
    endWeekDate = DateAdd("d", 6,firstWeekDate)	'month(firstWeekDate) & "/" & (day(firstWeekDate) + 6) & "/" & year(firstWeekDate)
    response.write "<br>"
    '******************************** By Farhat *************************************
    dim pk,firstday,lastday
    pk = "11/10/2011"
    week = (DatePart("ww",pk))
    
    firstday = dateadd("d",(-datepart("w",date())),pk)
    lastday = dateadd("d",(7-datepart("w",date())),pk)
    
    'response.write week
    'response.write "<br>"
    'response.Write firstday
    'response.write "<br>"
    'response.Write lastday
    
    '******************************** End *************************************
    %>
    <table border="1">
    <%
    for row=0 to 3
    firstRowDate = DateAdd("d", row,firstWeekDate)
    %>
    <tr>
    <% if row <> 3 then %>
    		<td><%=firstRowDate%></td><td><%=DateAdd("d", 4,firstRowDate)%></td>
    <% else %>
    		<td><%=firstRowDate%></td><td><table><tr><td><%=MonthView_ColumnHead(firstWeekDate,true,false)%> </td><td><%=MonthView_ColumnHead(DateAdd("m", 1,firstWeekDate),true,true)%></td></tr></table></td>
    <% end if %>
    </tr>
    <%
    next
    %>
    </table>
    </body>
    </html>
    
    
    <%
    function MonthView_RowHead(currDate, bShowWeekNum)
    'Note: WeekDayNames are short and placed in one top row i.e. Sat, Sun
    end function
    
    function MonthView_ColumnHead(currDate, bShowWeekNum,btranspose)
    'Note: WeekDayNames are full and placed in one column i.e. Satureday, Sunday
    	dim sMDate, eMDate, printDate, cLimit, rLimit
    	dim arrWeekDayName(), r, c, rH
    	if (bShowWeekNum=null) then
    		bShowWeekNum=false
    	end if
    	if (btranspose=null) then
    		btranspose=false
    	end if
    	if (not bShowWeekNum) then
    		cLimit = 6
    		rLimit = 7
    		redim arrWeekDayName(cLimit,rLimit)
    		sMDate = DateAdd("d",-1*day(currDate)+1,CDate(currDate))
    		eMDate = DateAdd("m",1,CDate(sMDate))
    		eMDate = DateAdd("d",-1,CDate(eMDate))
    		printDate = sMDate
    		for c=1 to cLimit
    			for r=1 to rLimit
    				if month(sMDate) = month(printDate) then
    					if c=1 then
    						arrWeekDayName(c,r) = WeekDayName(r)
    					else
    						if r=weekday(printDate) then
    							arrWeekDayName(c,r) = day(printDate)
    							printDate = DateAdd("d",1,CDate(printDate))
    						end if
    						if c=ubound(arrWeekDayName,1) and cint(arrWeekDayName(cLimit,rLimit)) <> 0 and cint(arrWeekDayName(cLimit,rLimit)) < day(eMDate) then
    							c = 1
    						end if
    					end if
    				end if
    			next
    		next
    	else
    	'response.write(FormatDateTime(now(),vblongdate))
    		cLimit = 6
    		rLimit = 8
    		redim arrWeekDayName(cLimit,rLimit)
    		sMDate = DateAdd("d",-1*day(currDate)+1,CDate(currDate))
    		eMDate = DateAdd("m",1,CDate(sMDate))
    		eMDate = DateAdd("d",-1,CDate(eMDate))
    		printDate = sMDate
    		for c=1 to cLimit
    			for r=1 to rLimit
    				if month(sMDate) = month(printDate) then
    					if c=1 and r>1 then
    						arrWeekDayName(c,r) = "<b>" & WeekDayName(1,true,r-1) & "</b>"
    					elseif r=1 and c>1 then
    						arrWeekDayName(c,r) = "<b>|" & datepart("ww", printDate) & "|</b>"
    						
    				    elseif r>1 and c>1 then
    						if r-1=weekday(printDate) then
    							
    	
    	
    	
    	
    							arrWeekDayName(c,r) =  day(printDate) 
    						    
    							printdate = DateAdd("d",1,CDate(printDate))
    							'if c>1 and r>1 then
    							 'arrWeekDayName(c,r) =  day(printDate) 
    						    'printdate = DateAdd("d",1,CDate(printDate))
    							'end if
    	
    						end if
    						if c=ubound(arrWeekDayName,1) and cint(arrWeekDayName(cLimit,rLimit)) <> 0 and cint(arrWeekDayName(cLimit,rLimit)) < day(eMDate) then
    							c = 1
    						end if
    					end if
    				end if
    			next
    		next
    	end if
    	
    	
    %>
    
    
    <table>
    	<%
    	if btranspose then
    	tempc =  rLimit
    	rLimit = cLimit
    	climit = tempc
    	end if
        'if climit>1 and rlimit>1 then
    	'response.Write(arrWeekDayName(climit,rlimit))
    	'end if
    	
        for r=1 to rLimit
        %>
        <tr>
            <%
    		for c=1 to cLimit
    		if btranspose then
    		tempc = r
    		tempr = c
    		else
    		tempc = c
    		tempr = r
    		
            end if
    		'if tempc>1 and tempr>1 then
    		'response.Write(arrWeekDayName(tempc,tempr))
    		'end if
    		%>
           
    		
           
           
            <td><a href="maincopy1.asp"  onclick="document.getElementById('first').value=document.getElementById('first').value"><%=arrWeekDayName(tempc,tempr)%></a></td>
          <%
    	    'if tempr>1 and tempc>1 then
    		'response.Write(arrWeekDayName(tempc,tempr))
    		'end if
    	   %>
    		<%
            next
            %>
        </tr>
        <tr>
        
        </tr>
        
        <%
    	next
    	%>
    </table>
    <%
    end function
    %>
    Last edited by WA; 12-13-2011 at 06:00 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •