Salve a tutti..
premetto che non cononosco il Javascript e avendo bisogno di un calendario ho scaricato gratuitamente questo script che vi posto.
Lo script contempla 1 solo calendario io, invece ho bisogno di 2 calendari.
Ho copiato ed incollato in successionelo script manon so dove mettere le mani.
Qualcuno me lo può correggere? GRAZIE 1000 a tutti.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
<!--
var fc_ie = false;
if (document.all) { fc_ie = true; }
var calendars = Array();
var fc_months = Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
var fc_openCal;
var fc_calCount = 0;
function getCalendar(fieldId) {
return calendars[fieldId];
}
function displayCalendarFor(fieldId) {
var formElement = fc_getObj(fieldId);
displayCalendar(formElement);
}
function displayCalendar(formElement) {
if (!formElement.id) {
formElement.id = fc_calCount++;
}
var cal = calendars[formElement.id];
if (typeof(cal) == 'undefined') {
cal = new floobleCalendar();
cal.setElement(formElement);
calendars[formElement.id] = cal;
}
if (cal.shown) {
cal.hide();
} else {
cal.show();
}
}
function display3FieldCalendar(me, de, ye) {
if (!me.id) { me.id = fc_calCount++; }
if (!de.id) { de.id = fc_calCount++; }
if (!ye.id) { ye.id = fc_calCount++; }
var id = me.id + '-' + de.id + '-' + ye.id;
var cal = calendars[id];
if (typeof(cal) == 'undefined') {
cal = new floobleCalendar();
cal.setElements(me, de, ye);
calendars[id] = cal;
}
if (cal.shown) {
cal.hide();
} else {
cal.show();
}
}
//--Class Stuff--------------------------------------------------
function floobleCalendar() {
// Define Methods
this.setElement = fc_setElement;
this.setElements = fc_setElements;
this.parseDate = fc_parseDate;
this.generateHTML = fc_generateHTML;
this.show = fc_show;
this.hide = fc_hide;
this.moveMonth = fc_moveMonth;
this.setDate = fc_setDate;
this.formatDate = fc_formatDate;
this.setDateFields = fc_setDateFields;
this.parseDateFields = fc_parseDateFields;
this.shown = false;
}
function fc_setElement(formElement) {
this.element = formElement;
this.format = this.element.title;
this.value = this.element.value;
this.id = this.element.id;
this.mode = 1;
}
function fc_setElements(monthElement, dayElement, yearElement) {
this.mElement = monthElement;
this.dElement = dayElement;
this.yElement = yearElement;
this.id = this.mElement.id + '-' + this.dElement.id + '-' + this.yElement.id;
this.element = this.mElement;
if (fc_absoluteOffsetLeft(this.dElement) < fc_absoluteOffsetLeft(this.element)) {
this.element = this.dElement;
}
if (fc_absoluteOffsetLeft(this.yElement) < fc_absoluteOffsetLeft(this.element)) {
this.element = this.yElement;
}
if (fc_absoluteOffsetTop(this.mElement) > fc_absoluteOffsetTop(this.element)) {
this.element = this.mElement;
}
if (fc_absoluteOffsetTop(this.dElement) > fc_absoluteOffsetTop(this.element)) {
this.element = this.dElement;
}
if (fc_absoluteOffsetTop(this.yElement) > fc_absoluteOffsetTop(this.element)) {
this.element = this.yElement;
}
this.mode = 2;
}
function fc_parseDate() {
if (this.element.value) {
this.date = new Date();
var out = '';
var token = '';
var lastCh, ch;
var start = 0;
lastCh = this.format.substring(0, 1);
for (i = 0; i < this.format.length; i++) {
ch = this.format.substring(i, i+1);
if (ch == lastCh) {
token += ch;
} else {
fc_parseToken(this.date, token, this.element.value, start);
start += token.length;
token = ch;
}
lastCh = ch;
}
fc_parseToken(this.date, token, this.element.value, start);
} else {
this.date = new Date();
}
if ('' + this.date.getMonth() == 'NaN') {
this.date = new Date();
}
}
function fc_parseDateFields() {
this.date = new Date();
if (this.mElement.value) this.date.setMonth(fc_getFieldValue(this.mElement) - 1);
if (this.dElement.value) this.date.setDate(fc_getFieldValue(this.dElement)) ;
if (this.yElement.value) this.date.setFullYear(fc_getFieldValue(this.yEleme nt));
if ('' + this.date.getMonth() == 'NaN') {
this.date = new Date();
}
}
function fc_setDate(d, m, y) {
this.date.setYear(y);
this.date.setMonth(m);
this.date.setDate(d);
if (this.mode == 1) {
this.element.value = this.formatDate();
} else {
this.setDateFields();
}
this.hide();
}
function fc_setDateFields() {
fc_setFieldValue(this.mElement, fc_zeroPad(this.date.getMonth() + 1));
fc_setFieldValue(this.dElement, fc_zeroPad(this.date.getDate()));
fc_setFieldValue(this.yElement, this.date.getFullYear());
}
function fc_formatDate() {
var out = '';
var token = '';
var lastCh, ch;
lastCh = this.format.substring(0, 1);
for (i = 0; i < this.format.length; i++) {
ch = this.format.substring(i, i+1);
if (ch == lastCh) {
token += ch;
} else {
out += fc_formatToken(this.date, token);
token = ch;
}
lastCh = ch;
}
out += fc_formatToken(this.date, token);
return out;
}
function fc_show() {
if (typeof(fc_openCal) != 'undefined') { fc_openCal.hide(); }
if (this.mode == 1) {
this.parseDate();
} else {
this.parseDateFields();
}
this.showDate = new Date(this.date.getTime());
if (typeof(this.div) != 'undefined') {
this.div.innerHTML = this.generateHTML();
}
if (typeof(this.div) == 'undefined') {
this.div = document.createElement('DIV');
this.div.style.position = 'absolute';
this.div.style.display = 'none';
this.div.className = 'fc_main';
this.div.innerHTML = this.generateHTML();
this.div.style.left = fc_absoluteOffsetLeft(this.element);
this.div.style.top = fc_absoluteOffsetTop(this.element) + this.element.offsetHeight + 1;
document.body.appendChild(this.div);
}
this.div.style.display = 'block';
this.shown = true;
fc_openCal = this;
}
__________
... continua sul successivo
__________