PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.www.webmaster > Javascript needed - PLEASE!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Javascript needed - PLEASE!

Réponse
 
LinkBack Outils de la discussion
Vieux 04/09/2007, 19h21   #1
itcassy@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Javascript needed - PLEASE!

I have posted my question on a couple other sites and have not
received any response. I desperately need to get this calendar
finished for a hospital.

I am working with Matt Kruse's Javascript Toolbox calendar popup and
have everything working correctly. I need to not only disable today's
date, but also the next two days. For the form I am working on, they
do not want people to be able to pick a date earlier than 3 days in
advance. I would appreciate any anyone can provide. I cannot
figure out how to add more time to the disabled portion of the script.
The form script is below:

Dates disabled: Anything up to today, December 25, 2007, and anything
after January 1, 2008.

<SCRIPT LANGUAGE="JavaScript" ID="js17">
var now = new Date();
var cal17 = new CalendarPopup("testdiv1");
cal17.setCssPrefix("TEST");
cal17.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));
cal17.addDisabledDates("12/25/2006");
cal17.addDisabledDates("Jan 1, 2008",null);
</SCRIPT>

<input type="text" name="date17" value="" size=25>
<A HREF="#"
onClick="cal17.select(document.forms[0].date17,'anchor17','MM/dd/
yyyy'); return false;"
TITLE="cal17.select(document.forms[0].date17,'anchor17','MM/dd/yyyy');
return false;" NAME="anchor17" ID="anchor17">select</A>

And the javascript can be referenced at: http://www.mattkruse.com/javascript/calendarpopup/

Thank you in advance for any .

  Réponse avec citation
Vieux 04/09/2007, 20h13   #2
Mark Goodge
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Javascript needed - PLEASE!

On Tue, 04 Sep 2007 18:21:30 -0000, itcassy@gmail.com put finger to
keyboard and typed:

>I have posted my question on a couple other sites and have not
>received any response. I desperately need to get this calendar
>finished for a hospital.
>
>I am working with Matt Kruse's Javascript Toolbox calendar popup and
>have everything working correctly. I need to not only disable today's
>date, but also the next two days. For the form I am working on, they
>do not want people to be able to pick a date earlier than 3 days in
>advance. I would appreciate any anyone can provide. I cannot
>figure out how to add more time to the disabled portion of the script.
>The form script is below:
>
>Dates disabled: Anything up to today, December 25, 2007, and anything
>after January 1, 2008.


Untested, but try this. My lines indented for clarity:

<SCRIPT LANGUAGE="JavaScript" ID="js17">
var now = new Date();

var tomorrow = new Date();
tomorrow.setTime(now.getTime() + 86400000)

var dayftertomorrow = new Date();
dayftertomorrow.setTime(now.getTime() + 172800000)

var cal17 = new CalendarPopup("testdiv1");
cal17.setCssPrefix("TEST");
cal17.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));

call7.addDisabledDates(null,formatDate(tomorrow,"y yyy-MM-dd"));

call7.addDisabledDates(null,formatDate(dayaftertom orrow,"yyyy-MM-dd"));

cal17.addDisabledDates("12/25/2006");
cal17.addDisabledDates("Jan 1, 2008",null);
</SCRIPT>

(You don't need to modify the HTML input or links at all)

What you're doing here is calculating a time for tomorrow and the day
after tomorrow, based on the time for today. 86400000 is 24 hours in
milliseconds (the unit that getTime() uses), and 172800000 is,
obviously, 48 hours. These calculated dates are then fed back into the
script as additional variables for the addDisabledDates() function.

There's probably a more elegant way of doing it, and it's possible
that my suggestion won't actually work, but there should be enough
here to work on if it needs tweaking.

Mark
--
http://www.MotorwayServices.info - read and share comments and opinons
"Nothing takes the past away like the future"
  Réponse avec citation
Vieux 05/09/2007, 01h30   #3
Nikita the Spider
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Javascript needed - PLEASE!

In article <1188930090.363386.133570@d55g2000hsg.googlegroups .com>,
itcassy@gmail.com wrote:

> I have posted my question on a couple other sites and have not
> received any response.


There's always comp.lang.javascript if you haven't tried there already...

--
Philip
http://NikitaTheSpider.com/
Whole-site HTML validation, link checking and more
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08808 seconds with 11 queries