Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 23rd, 2011, 12:11 AM
teahou55 teahou55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2011
Posts: 9 teahou55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 38 sec
Reputation Power: 0
Popup calendar not working on win mobile 5

I am working on a mobile site (my first) and I have a popup calendar on one of the pages, which is used to select and auto fill the date filed. This option works fine on my PC, iphone and android, but not on the PDAs running windows mobile 5, which will be the main platform for my site.

Here is the code for the calendar, please look it over and either give me some hints, or a good reference which deals directly with my issue. thank you.

Code:



    <script language="javascript" type="text/javascript">
    /* <[CDATA[ */
           var dateObject = new Date();
           var month = dateObject.getMonth();
           var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
           function getTodayDate()
           {
           	var dateToday = monthArray[month] + " "
           		+ dateObject.getDate() + ", "
           		+ dateObject.getFullYear();
           	document.formInfo.date.value = dateToday;
           }
           
           function displayCalendar(whichMonth)
           {
           	calendarWin = window.open("", "CalWindow", "status=no, resizable=yes, width=230, height=200, left=50, top=100");
           	calendarWin.focus();
           	calendarWin.document.write("<!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=iso-8859-1' /> "
    			+ "<title>Calendar</title> <link href='style.css' rel='stylesheet' type='text/css' /></head><body>");
		calendarWin.document.write("<table cellspacing='0' border='1' width='100%'>");
		calendarWin.document.write("<colgroup span='7' width='50' />");
		
		//calendarWin.document.write("<tr><td colspan='7' align='center'><strong>" + monthArray[month] + " " + dateObject.getFullYear() + "</strong>></td></tr>");
		
		if (whichMonth == -1)
		{
			dateObject.setMonth(dateObject.getMonth()-1);
		}
		else if (whichMonth == 1)
		{
			dateObject.setMonth(dateObject.getMonth()+1);
		}		
		var month = dateObject.getMonth();
		calendarWin.document.write("<tr><td colspan='2'><a href='' onclick='self.opener.displayCalendar(-1); return false'>Previous</a></td> "
			+ "<td colspan='3' align='center'><strong>" + monthArray[month] + " " + dateObject.getFullYear() + "</strong></td> "
			+ "<td colspan='2' align='right'><a href='' onclick='self.opener.displayCalendar(1); return false'>Next</a></td></tr>");
				
		
		calendarWin.document.write("<tr align='center'><td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thu</td><td>Fri</td><td>Sat</td></tr>");
		calendarWin.document.write("<tr align='center'>");
		
		dateObject.setDate(1);
		var dayOfWeek = dateObject.getDay();
		for (var i=0; i<dayOfWeek; i++)
		{
			calendarWin.document.write("<td>&nbsp;</td>");
		}
		
		var daysWithDates = 7 - dayOfWeek;
		var dateCounter = 1;
		for(var i=0; i<daysWithDates; i++)
		{
			var curDate = monthArray[month] + " "
				+ dateCounter + ", "
				+ dateObject.getFullYear();
			calendarWin.document.write("<td><a href='' onclick='self.opener.document.formInfo.date.value=\"" + curDate + "\";self.close()'>" + dateCounter + "<a/></td>");
			++dateCounter;
		}
		
		var numDays = 0;
		//January, March, may, July, August, October, December
		if (month == 0 || month == 2 || month == 4 || month == 6 || month == 6 || month == 7 || month == 9|| month == 11)
		{
			numDays = 31;
		}
		// February
		else if (month == 1)
		{
			numDays = 28;
		}
		// April, June, Septembr, November
		else if (month == 3 || month == 5 || month == 8 || month == 10)
		{
			numDays = 30;
		}
		
		for (var rowCounter = 0; rowCounter < 5; rowCounter++)
		{
			var weekDayCounter = 0;
			calendarWin.document.write("<tr align='center'>");
			
			while (weekDayCounter < 7)
			{
				var curDate = monthArray[month] + " "
					+ dateCounter + ", "
					+ dateObject.getFullYear();
				if (dateCounter <= numDays)
				{
					calendarWin.document.write("<td><a href='' onclick='self.opener.document.formInfo.date.value=\"" + curDate + "\";self.close()'>" + dateCounter + "</a></td>");
				}
				else
				{
					calendarWin.document.write("<td>&nbsp;</td>");
				}				
				++weekDayCounter;
				++dateCounter;
				
			}
			calendarWin.document.write("</tr>");
		}
		calendarWin.document.write("</table></body></html>");
		calendarWin.document.close();
		
	}
/* <]] */
</script>

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > Popup calendar not working on win mobile 5

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap