Ajouts messages de retour du formulaire de demande de réinitialisation de mot de...
[Plinn.git] / skins / jscalendar / bugtest-hidden-selects.html
1 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ro" lang="ro">
2
3 <head>
4 <title>Bug</title>
5 <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-1.css" title="win2k-1" />
6
7 <!-- import the calendar script -->
8 <script type="text/javascript" src="calendar.js"></script>
9
10 <!-- import the language module -->
11 <script type="text/javascript" src="lang/calendar-en.js"></script>
12
13 <!-- helper script that uses the calendar -->
14 <script type="text/javascript">
15 // This function gets called when the end-user clicks on some date.
16 function selected(cal, date) {
17 cal.sel.value = date; // just update the date in the input field.
18 if (cal.sel.id == "sel1" || cal.sel.id == "sel3")
19 // if we add this call we close the calendar on single-click.
20 // just to exemplify both cases, we are using this only for the 1st
21 // and the 3rd field, while 2nd and 4th will still require double-click.
22 cal.callCloseHandler();
23 }
24
25 // And this gets called when the end-user clicks on the _selected_ date,
26 // or clicks on the "Close" button. It just hides the calendar without
27 // destroying it.
28 function closeHandler(cal) {
29 cal.hide(); // hide the calendar
30 }
31
32 // This function shows the calendar under the element having the given id.
33 // It takes care of catching "mousedown" signals on document and hiding the
34 // calendar if the click was outside.
35 function showCalendar(id, format) {
36 var el = document.getElementById(id);
37 if (calendar != null) {
38 // we already have some calendar created
39 calendar.hide(); // so we hide it first.
40 } else {
41 // first-time call, create the calendar.
42 var cal = new Calendar(false, null, selected, closeHandler);
43 // uncomment the following line to hide the week numbers
44 // cal.weekNumbers = false;
45 calendar = cal; // remember it in the global var
46 cal.setRange(1900, 2070); // min/max year allowed.
47 cal.create();
48 }
49 calendar.setDateFormat(format); // set the specified date format
50 calendar.parseDate(el.value); // try to parse the text in field
51 calendar.sel = el; // inform it what input field we use
52 calendar.showAtElement(el); // show the calendar below it
53
54 return false;
55 }
56
57 var MINUTE = 60 * 1000;
58 var HOUR = 60 * MINUTE;
59 var DAY = 24 * HOUR;
60 var WEEK = 7 * DAY;
61
62 // If this handler returns true then the "date" given as
63 // parameter will be disabled. In this example we enable
64 // only days within a range of 10 days from the current
65 // date.
66 // You can use the functions date.getFullYear() -- returns the year
67 // as 4 digit number, date.getMonth() -- returns the month as 0..11,
68 // and date.getDate() -- returns the date of the month as 1..31, to
69 // make heavy calculations here. However, beware that this function
70 // should be very fast, as it is called for each day in a month when
71 // the calendar is (re)constructed.
72 function isDisabled(date) {
73 var today = new Date();
74 return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
75 }
76 </script>
77 </head>
78
79 <body>
80 <form>
81 <b>Date:</b>
82 <br>
83 <input type="text" name="date1" id="sel1" size="30">
84 <input type="button" value="..." onclick="return showCalendar('sel1', 'y-m-d');">
85 <p>
86 <br>
87 <br><b>Visible &lt;select&gt;, hides and unhides as expected</b>
88 <br>
89 <select name="foo" multiple>
90 <option value="1">can use the functions date.getFullYear() -- returns</option>
91 <option value="2">4 digit number, date.getMonth() -- returns the month</option>
92 <option value="3">heavy calculations here. However, beware that this</option>
93 </select>
94
95 <p>
96 <br><b>Hidden &lt;select&gt;, it should stay hidden (but doesn't)</b>
97 <br>
98 <select name="foo2" multiple style="visibility: hidden">
99 <option value="1">this should</option>
100 <option value="2">remain hidden right?</option>
101 </select>
102
103 <p>
104 <br><b>Hidden textbox below, it stays hidden as expected</b>
105 <br>
106 <input type="text" name="foo3" value="this stays hidden just fine" style="visibility: hidden">
107 </form>
108 </body></html>