SunQuest
 
           Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

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 ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old December 13th, 2005, 11:33 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
Post Pure Javascript Calendar

yet another calendar, allowing the user to select date.

unlike most calendars though, this one use pure javascript,
requires minimum code and is not using pop up window.

it also can be customized in most, e.g. fonts, colors and text size.

I will attach the full source code and usage sample, and post it
here as well:
Code:
--Calendar.js
var _panelID="CalendarPanel";
var _currentYear=0;
var _currentMonth=-1;
function OpenCalendar(defYear, defMonth, defDay) {
	var now=new Date();
	if ((typeof defYear == "undefined")||(isNaN(defYear)))
		defYear = now.getFullYear();
	if ((typeof defMonth == "undefined")||(isNaN(defMonth)))
		defMonth = now.getMonth();
	else
		defMonth--;
	if ((typeof defDay == "undefined")||(isNaN(defDay)))
		defDay = now.getDate();
	FillCalendar(defYear, defMonth+1, defDay);
	
	var objPanel = document.getElementById(_panelID);
	objPanel.style.display = "block";
	var panelWidth = GetElementWidth(objPanel);
	var panelHeight = GetElementHeight(objPanel);
	var bodyWidth = document.body.clientWidth;
	var bodyHeight = document.body.clientHeight;
	var panelLeft = parseInt((bodyWidth/2)-(panelWidth/2));
	var panelTop = parseInt((bodyHeight/2)-(panelHeight/2));
	objPanel.style.left = panelLeft+"px";
	objPanel.style.top = panelTop+"px";
}

function FillCalendar(year, month, day) {
	//var date=new Date();
	//date.setFullYear(year+1, month, day);
	//alert(date);
	
	_currentYear = year;
	_currentMonth = month-1;
	
	var daysCount=DaysInMonth(year, month);
	var objPanel = document.getElementById(_panelID);
	if (!objPanel) {
		objPanel = document.createElement("div");
		objPanel.id = _panelID;
		objPanel.style.position = "absolute";
		objPanel.style.display = "none";
		objPanel.style.border = _calenderBorderSize+"px solid "+_calenderBorderColor;
		objPanel.style.backgroundColor = _calendarBackground;
		objPanel.onclick = new Function("HideCalendar()");
		document.body.appendChild(objPanel);
	}
	
	while (objPanel.childNodes.length > 0)
		objPanel.removeChild(objPanel.childNodes[0]);

	BuildCalendarDetails(objPanel, _currentMonth, _currentYear);
	
	var cellWidth=50;
	var cellHeight=50;
	var currentDay=1;
	var objTable=document.createElement("table");
	objTable.setAttribute("border", "0");
	objTable.setAttribute("cellpadding", "0");
	objTable.setAttribute("cellspacing", "0");
	var objRow=0;
	while (currentDay <= daysCount) {
		if (((currentDay-1)%7) == 0) {
			objRow=objTable.insertRow(objTable.rows.length);
		}
		for (var i=1; i<=7; i++) {
			if (currentDay > daysCount)
				break;
			var objCell=objRow.insertCell(objRow.cells.length);
			objCell.setAttribute("width", cellWidth+"");
			objCell.setAttribute("height", cellHeight+"");
			objCell.style.border = "1px solid black";
			objCell.style.textAlign = "center";
			objCell.style.backgroundColor = _calenderCellColor;
			objCell.style.fontFamily = _calenderCellFontName;
			objCell.style.fontSize = _calenderCellFontSize;
			objCell.style.cursor = "pointer";
			objCell.onmouseover = new Function("PutMoreLight(this)");
			objCell.onmouseout = new Function("RestoreColor(this)");
			objCell.onclick = new Function("CalenderCellClick(this);");
			objCell.innerHTML = currentDay+"";
			currentDay++;
		}
	}
	objPanel.appendChild(objTable);
	//window.resizeTo(objTable.clientWidth, objPanel.offsetHeight);
}

function BuildCalendarDetails(objContainer, month, year) {
	var btnPreviousMonth=BuildCalendarButton((_rightToLeft  )?">>":"<<");
	btnPreviousMonth.onclick = PreviousMonthClick;
	
	var btnNextMonth=BuildCalendarButton((_rightToLeft)?"<<":">>");
	btnNextMonth.onclick = NextMonthClick;
	
	var objMonthSpan=BuildCalendarSpan(_monthNames[month]);
	var objYearSpan=BuildCalendarSpan(year+"");
	
	var objSpan=document.createElement("div");
	objSpan.id = _panelID+"_details";
	objSpan.style.textAlign = "center";
	objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
	if (_rightToLeft) {
		objSpan.appendChild(btnNextMonth);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(objMonthSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;&nbsp;&nbsp;"));
		objSpan.appendChild(objYearSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnPreviousMonth);
	}
	else {
		objSpan.appendChild(btnPreviousMonth);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(objYearSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;&nbsp;&nbsp;"));
		objSpan.appendChild(objMonthSpan);
		objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
		objSpan.appendChild(btnNextMonth);
	}
	objSpan.appendChild(BuildCalendarSpan("&nbsp;"));
	//objSpan.appendChild(BuildCalendarSpan("<br />"));
	objContainer.appendChild(objSpan);
}

function BuildCalendarButton(strText) {
	var result=document.createElement("button");
	result.setAttribute("type", "button");
	result.style.fontSize = "18px";
	result.innerHTML = strText;
	return result;
}

function BuildCalendarSpan(strText) {
	var result=document.createElement("span");
	result.style.fontFamily = _calenderTextFontName;
	result.style.fontSize = _calenderTextFontSize;
	result.style.color = _calenderTextColor;
	result.innerHTML = strText;
	return result;
}

function CalenderCellClick(objCell) {
	//hide:
	HideCalendar();
	
	//set date:
	var date=new Date();
	date.setFullYear(_currentYear, _currentMonth, parseInt(objCell.innerHTML));
	
	//activate callback function:
	eval(_calendarCallbackFunction+"('"+date+"')");
}

function HideCalendar() {
	var objPanel = document.getElementById(_panelID);
	objPanel.style.display = "none";
}

function PreviousMonthClick() {
	_currentMonth--;
	if (_currentMonth < 0) {
		_currentMonth = 11;
		_currentYear--;
	}
	FillCalendar(_currentYear, _currentMonth+1, 1);
}

function NextMonthClick() {
	_currentMonth++;
	if (_currentMonth > 11) {
		_currentMonth = 0;
		_currentYear++;
	}
	FillCalendar(_currentYear, _currentMonth+1, 1);
}

function DaysInMonth(year, month) {
	var date=new Date();
	var result=0;
	date.setFullYear(year, month-1, 1);
	while ((date.getFullYear() <= year)&&(date.getMonth() <= (month-1))) {
		result++;
		if (result > 31) {
			alert("error getting days in month!\nyear: "+year+", month: "+month);
			return 0;
		}
		date.setFullYear(year, month-1, date.getDate()+1);
	}
	return result;
}

function GetElementWidth(element) {
	return element.clientWidth;
}

function GetElementHeight(element) {
	return element.clientHeight;
}

var arrColoredControls=new Array();
function PutMoreLight(objControl, color, lightAmount) {
	var cancelAddLight=objControl.getAttribute("cancel_add_light");
	if (cancelAddLight == "1")
		return true;
	
	if (typeof color == "undefined")
		color = _calenderCellColor;
	
	if (typeof lightAmount == "undefined")
		lightAmount = _calendarAddLight;
	
	arrColoredControls[objControl] = color;
	
	var R=HexToInt(color.substring(1, 3));
	var G=HexToInt(color.substring(3, 5));
	var B=HexToInt(color.substring(5, 7));
	
	R = SafeAdd(R, lightAmount, 0, 255);
	G = SafeAdd(G, lightAmount, 0, 255);
	B = SafeAdd(B, lightAmount, 0, 255);
	
	var lightedColor=BuildColor(R, G, B);
	objControl.style.backgroundColor = lightedColor;
}

function RestoreColor(objControl) {
	var cancelAddLight=objControl.getAttribute("cancel_add_light");
	if (cancelAddLight == "1")
		return true;
	objControl.style.backgroundColor = arrColoredControls[objControl];
}

function IntToHex(num) {
	if (num < 10)
		return (num+"");
	
	switch (num) {
		case 10: return "a";
		case 11: return "b";
		case 12: return "c";
		case 13: return "d";
		case 14: return "e";
		case 15: return "f";
	}
	
	return IntToHex(parseInt(num/16))+IntToHex(parseInt(num%16));
}

function HexToInt(strHex) {
	return parseInt(strHex, 16);
}

function SafeAdd(num, addition, min, max) {
	num += addition;
	if (num > max)
		num = max;
	if (num < min)
		num = min;
	return num;
}

function BuildColor(r, g, b) {
	var R=IntToHex(r);
	var G=IntToHex(g);
	var B=IntToHex(b);
	R=(R.length == 1)?("0"+R):R;
	G=(G.length == 1)?("0"+G):G;
	B=(B.length == 1)?("0"+B):B;
	return "#"+R+G+B;
}


Code:
--CalendarTest.html
<html>
<head>
<meta http-equiv="Content-Type" context="text/html; charset=windows-1255" />
<title>Calendar Test</title>
<script type="text/javascript">
//var _monthNames=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var _monthNames=new Array("ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר");
var _rightToLeft=true;
var _calendarBackground="#B5C3C3";
var _calenderBorderSize=3;
var _calenderBorderColor="blue";
var _calenderCellColor="#F6B853";
var _calenderCellFontName="Tahoma";
var _calenderCellFontSize="21px";
var _calenderTextFontName="Tahoma";
var _calenderTextFontSize="22px";
var _calenderTextColor="white";
var _calendarAddLight=30;
var _calendarCallbackFunction="CalendarCallback";
</script>
<script type="text/javascript" src="Calendar.js"></script>
<script type="text/javascript">
function BrowseDate() {
	var strDate = document.forms[0].elements["Date"].value;
	var arrParts=strDate.split("/");
	OpenCalendar(parseInt(arrParts[2]), parseInt(arrParts[1]), parseInt(arrParts[0]));
}

function CalendarCallback(strSelectedDate) {
	var date=new Date(strSelectedDate);
	document.forms[0].elements["Date"].value = date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
}
</script>
</head>
<body>
Hello World!
<form>
Date: <input type="text" name="Date" /><button type="button" onclick="BrowseDate();">...</button>
</form>
</body>
</html>


the usage sample let you choose date and put it inside textbox.
any comments or questions are welcome!
Comments on this post
smeg4brains agrees: Great little script
Attached Files
File Type: zip Calendar.zip (3.0 KB, 3170 views)

Reply With Quote
  #2  
Old December 13th, 2005, 11:36 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
important note: you should not change the code inside Calendar.js!
you have to include that file as-is, any changes will cause unknown problems.

Reply With Quote
  #3  
Old December 14th, 2005, 09:33 AM
sivaramanrajesh's Avatar
sivaramanrajesh sivaramanrajesh is offline
.NET Disciple
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: http://UAE/Dubai/Media-City/Nurture3.aspx
Posts: 349 sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level)sivaramanrajesh User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 19 h 58 m 30 sec
Reputation Power: 158
English Version????

Shadow..
Any English version available for the calendar.
Thanks
Rajesh Sivaraman.

Reply With Quote
  #4  
Old December 14th, 2005, 10:36 AM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,853 baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)baseballdude_ User rank is Sergeant Major (2000 - 5000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 9 h 18 m 15 sec
Reputation Power: 45
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
Modify these lines in CalendarTest.html:
Code:
//var _monthNames=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var _monthNames=new Array("ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר");

To:
Code:
var _monthNames=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
//var _monthNames=new Array("ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר");

Reply With Quote
  #5  
Old December 14th, 2005, 03:14 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
yep BBD is 100% correct - changing language is as easy as that.

Reply With Quote
  #6  
Old June 29th, 2006, 02:12 PM
smeg4brains smeg4brains is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 4 smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 48 m 16 sec
Reputation Power: 0
Updated/changed version

I've used this calendar as a foundation and rewritten much of it for some of the thing we needed here for our site. Unfortunately, I've taken some of the flexiblity away, but occationally added other flexibility.

Differences:

I got rid of most global variables that were not just configuration. That way two calendars can run at the same time and be interacted with without messing eachother up.

I put the days into S,M,T,W,T,F,S columns, and shaded sunday and monday a little darker.

I took out the right to left code since we'd never use it, and it made the code easier for me to read . (left to right is only option now)

The default format is 'mm-dd-yyyy' now, but should still be easily changed.

Now you simply give your input field and ID= setting, and launch BrowseDate wtih "BrowseDate(ID)".

When a change is made, the "onchange" of your input box is executed.

I generally shrunk the whole thing by changing the default font sizes and stuff.

I made the calendar pop-up relative to where your input box is, so if you know the size of your box, you can make it up in a predictable stop right next to the mouse if you like..

I don't think I made it too much longer or slower.. I think it's still pretty snappy which is what attracted me to it in the first place. I think IE renders it slowly, but firefox is very quick.. I'm sure IE7 will probably be quick.

I'm not really done yet, but I thought someone might be interested because it's a good little calendar that doesn't get in your way.. It integrates very easily, and it's pretty self-contained which is what attracted me to it in the first place...
Comments on this post
Shadow Wizard agrees: thanks!
Attached Files
File Type: zip cal.zip (2.7 KB, 736 views)

Reply With Quote
  #7  
Old July 1st, 2006, 10:59 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
sounds great - welcome to the forum and thanks!

Reply With Quote
  #8  
Old July 5th, 2006, 04:34 AM
Shimon Shimon is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 6 Shimon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 23 m 44 sec
Reputation Power: 0
Question

Any chance of some code on how you call the - updated - calender control?
Thanks

Reply With Quote
  #9  
Old July 5th, 2006, 02:36 PM
smeg4brains smeg4brains is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 4 smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 48 m 16 sec
Reputation Power: 0
Usage example

I'm working on another updated version. It currently has highlighting of the currently selected day, and highlighting of "today" as well, but I'm also going to add a "today" button, s,m,t,w,t,f,s column headers, and a better close mechanism. I'd also like to fix a rendering problem with the previous/next buttons. I want them justified out into the corners all the way, and right now it's just approximated with some spacing of the text between them. I couldn't find a happy css way to do it though, so I'll probably be putting them into a small table :/...

This is the code that my other code generates to use it.. (I've chopped out some css style stuff, but mechanically, this should work). The "780534342" is just generated by srand() so that I have unique ID's and can have many calendar's on a page. Any ID should be fine as long as it's unique to the input box that you'd like the values to be taken from and written to.


<form>
<input type=text id='780534342' title='mm-dd-YYYY' name='submitted_to_eng' value='' size=10 onchange="">

<a href=javascript:void(0); onclick="BrowseDate('780534342');" title='Choose Date'>
<img src='/images/show-calendar2.gif' border=0>
</a>
</form>

Reply With Quote
  #10  
Old July 7th, 2006, 12:47 PM
smeg4brains smeg4brains is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 4 smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level)smeg4brains User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 48 m 16 sec
Reputation Power: 0
New version

OK, this is my latest calendar version. It's fairly complete. It could be more configurable, but I've been entertaining myself trying to make it as short as possible.

Usage is simple (note: ID must be numeric, I don't know why):
<input id='2112' type=text size=10 name=form_field_name>
<a href=javascript:BrowseDate('2112');>Edit Date</a>

<input id='2113' type=text size=10 name=form_field_name>
<a href=javascript:BrowseDate('2113');>Edit Date2</a>

A better example can be found at:
http://pipeline.umci.com/javascript/cal_example.html

I'm having troubles figuring out why it's so slow in IE, but so blazingly fast in firefox. Most of our userbase is firefox so it doesn't matter that much, but it'd sure be great to fix anyway. I've tried to fix most of the obviously extraneous string catenations, but this had little/no affect.

If anyone knows why this is slow in IE, I'd love to fix it. I'm afraid I'm not much of a javascript programer though. It looks like it runs quickly, and renders quickly, but then there's a delay before the onclick on the table cell becomes available. It's strange because it should be done with the code by then.

Wishlist:
1) Figure out why the "id" fields have to be numeric.. I'm pretty sure I've used arbitrary text with getElementById before and it's worked fine, so it must be something I'm doing.

2) I would like to make it so you can click on the month/year, and you get a month/year list going backward and forward about a year (with arrows to jump the list by a year back and forward).

3) I would like to create a view that shows an entire year at a time.

Reply With Quote