The most refined calendar date input control (Smart Ver 1.00)

zhaozj2021-02-16  52

The most refined calendar date input control (Smart Ver 1.00) </ Title> </ head> <style> body {font-size: 12px; font-family: "tahoma";} TD {font-size: 12px; font-family: "tahoma";}. Inputdate {border: 1px solid # 7287c6; text-align : center; font-size: 12px; font-style: normal; height: 16px;} </ stop></p> <p><! - / *********************************************************************************************************************************************************************************************************************************************************************************************** ******************************* time: 2004-01-01 author: Smart functions: calendar-style date selection control parameters: Description: 1. Input box directly call <script> DateBox ("InputName", "DateValue") <// script> where: InputName is the text box for the input date. Note: No empty. DateValue is the input date Text box default date value. Format is: YYYY-mm-dd. Such as 2004-01-01 This value can not fill or empty. The default value is the same day. (Client) 2. Other "Button" call with the following Code CallDate ("InputName") where: INPUTNAME is the text box for the input date. Note: You can't be empty.</p> <p>Modify the area</p> <p>Time: Modify: Cause:</p> <p>*********************************************************** ****************** / / * Basic parameters * / var fw = 106; // calendar width var FRH = 137; // Calendar height var FRS = 4; // Shadow size var hid = true; // calendar to open / * Create a frame * / document.writeln ('<div id = calendar author = smart scrolling = "no" frameborder = 0 style = "border: 0px solid #eeeee; position : absolute; Width: ' frw '; Height: ' FRH '; Z-Index: 0; Filter: / 'Progid: DxImageTransform.microsoft.Shadow (Direction = 135, Color = # aaaaaa, stregth =' frs ' ) / '; display: none> </ div>); / * acquire today * / function getTodayDate () {Today = new date (); y = Today.GetyEAR (); m = (Today.getMonth) ) 1); if (m <10) {m = '0' m;} D = Today.getdate (); if (d <10) {d = '0' D;} return y '-' m '-' D} / * Enter Today's Date * / Function SetTodayDate (InputBox) {hiddencalendar (); InputBox.Value = getTodayDate ();} / * Take a week's first day of the week (month - 1) * / function getFirstweek (THE_YEAR, THE_MONTH) {RETURN (New Date (THE_YEAR, THE_MONTH-1)). GetDay ()} / * Take a certain number of days in a certain month * / function getthisDays (THE_YEAR, THE_MONTH) {RETURN (New Date (THE_YEAR, THE_MONTH, 0)). GetDate ()} / * One year month of last month * / function getLastDays (THE_YEAR, THE_MONTH) {RETURN (New Date (THE_YEAR, THE_MONTH-1, 0)). GetDate ()} / * Judging whether it is a leap year * / function runnian The_Year) {IF ((THE_Year% 400 == 0) || ((THE_YEAR% 4 == 0) && (The_Year% 100! = 0))) Return True; Else Return False;} / * Judgment Date (YYY- Date of MM-DD) is correct * / function dateistrue (asdate) {var l 4date = askATE ""; var = lsdate.split ("-"); if (Lodate.Length! = 3) Return False; Var Liyear = Parsefloat (Lodate [0]);</p> <p>Var limonth = parsefloat (Lodate [1]); var liday = parsefloat (Lodate [2]); if ((Lodate [0] .length> 4) || (Lodate [1] .length> 2) || (Lodate [2] .length> 2) Return False; IF (ISNAN || ISNAN (Limonth) || isnan (liday)) Return False; IF ((Liyear <1800) || (liyear> 2500)) Return False; if ((Limonth> 12) || (Limonth <= 0)) Return False; IF (GetThisDays (Liyear, Limonth <liday) Return False; Return! Isnan (Date.utc (Liyear, Limonth, Liday)) } / * Take a measure of a month * / function getCountWeeks (the_Year, THE_MONTH) {var allday; alLDay = 0; if (the_year> 2000) {for (i = 2000; i <the_year; i ) IF (i ) IF Runnian (i)) alLDay = 366; Else AllDay = 365; for (i = 2; i <= THE_MONTH; I ) {switch (i) {casse 2: if (runnian (the_year) alLDAY = 29; Else Allday = 28; Break; Case 3: Allday = 31; Break; Case 4: alLDay = 30; Break; Case 5: alLDay = 31; Break; Case 6: alLDay = 30; Break; Case 7 : AlLDay = 31; Break; Case 8: allday = 31; Break; Case 9: Al LDAK; Case 10: allday = 31; Break; Case 11: alLDay = 30; Break; Case 12: alLDay = 31; Break;}}} Return (AllDay 6)% 7;} / * Input box Show * / Function InputValue (InputBox, Year, Month, Day) {if (Month <10) {MONTH = '0' MONTH} IF (DAY <10) {day = '0' day} inputbox .value = year "-" MONTH "-" day} // last month Function ForwardMont (InputBox, Year, Month, day) {MONTH = MONTH-1; IF (Month <1) {Month = 12; Year = YEAR-1;</p> <p>IF (Year <1800) Year = 2500;} day = (GetThisDays (Year, Month): GetThisDays (Year, Month): day) hid = false; showcalendar (Inputbox, Year, Month, day)} / / January Function Nextmonth (InputBox, Year, Month, Day) {MONTH = MONTH 1; if (Month> 12) {Month = 1; Year = Year 1; IF (Year> 2500) Year = 1800;} Day = (GetThisDays (Year, Month) <day? GetThisdays (Year, Month): day) hid = false; showcalendar (Inputbox, Year, Month, day)} // Function Forwardyear (Inputbox, Year, Month, day) {year = year-1; if (Year <1800) Year = 2500; day = (GetThisDays (Year, Month) <day)? GetThisDays (Year, Month): day) hid = false; showcalendar Inputbox, Year, Month, Day)} // The next year Function nextyear (Inputbox, Year, Month, day) {year = year 1; if (Year> 2500) Year = 1800; day = ((GetThisDays (Year, Month) <day): getthisdays (year, month): day) hid = false; showcalendar (Inputbox, Year, Month, day)} / * Other Event Show Calendar * / Function OpenDate (where) {getcalendar (where)} / * Display the calendar * / function getcalendar according to the date in the input box {hid = fals E; var box_name = where.name; var box_value = where.value; if (Dateistrue (Box_Value)) {LODATE = Box_Value.Split ("-"); y = parsefloat (Lodate [0]); m = parsefloat (Lodate [1]); D = PARSEFLOAT (Lodate [2]); showcalendar (where, y, m, d);} else {Today = new Date (); y = Today.GetyEAR (); m = (Today.GeTMonth () 1); d = Today.Getdate (); showcalendar (where, y, m, d);}}</p> <p>/ * Hide Calendar * / Function HiddenCalendar () {document.all.calendar.style.display = "none";} Function Closecalendar ()} Function CloseCalendar ()} Document.All.Calendar.Style.Display = "none"; hid = true;} / * display calendar * / function ShowCalendar (InputBox, The_Year, The_Month, The_Day) {var Now_Year = (The_Year == null 2004:? The_Year); var Now_Month = (The_Month == null 1: The_Month?); var Now_Day = (The_Day == null 1: The_Day?); var Box_Name = 'window.parent.document.all.' InputBox.name; var fw = GetFirstWeek (Now_Year, Now_Month); var ld = GetLastDays (Now_Year, Now_Month VAR TD = GetThisDays (now_year, now_month); var isnd = false; // is the date of the next month var D = 1, w = 1; var FrameContent; Var FRL, FRT, WINW, WINH; / * Display position * / Winw = document.body.offsetWidth; Winh = document.body.offsetHeight; Frl = InputBox.getBoundingClientRect () left-2;. Frt = InputBox.getBoundingClientRect () top InputBox.clientHeight;. if ((( FRL FRW FRS)> WINW) && (FRW FRS <WINW)) FRL = WINW-FRW-FRS; IF ((FRT FRH FRS> WINH) && (FRH FRS <WinH)) FRT = WinH- FRH-FRS; Document.All.calendar.Style.Display = "" Document.all.calendar.Style.LLT = fr1; document.all.calendar.style.top = frt; // Display Calendar content FrameContent = "/ n <Table OnseTart = /" Return False; / "Border = '0 'Cellpadding =' 0 'Cellspacing =' 0 'bgcolor =' # 395592 'width =' 100% 'Height = '15' style = / "color: white; font-weight: bolder; border: 0px solid /"> " "/ n <tr> / n"; framecontent = "<td width = 8>"; framecontent = "<img src = 'inc / -. GIF'</p> <p>Width = '8' Height = '11 'border =' 0 'alt =' previous year 'style =' cursor: hand 'οnclick = / "parent.forwardyear (window.parent.document.all." inputbox.name "," Now_year "," now_day ") /"> "; framecontent =" </ td> / n "; framecontent =" <td valign = middle align = 'center'> "FrameContent = Now_Year; FrameContent = "year"; FrameContent = "</ td> / n"; framecontent = "; FrameContent =" <IMG SRC = 'inc / . Gif' width = '8' Height = '11 'border =' 0 'alt =' Next year 'style =' cursor: hand 'οnclick = / "parent.nextyear (window.parent.document.all." inputbox.name "," now_year " .gif 'width =' 8 'Height = '11' border = '0' alt = 'last Jan' style = 'cursor: hand' οnclick = / "parent.forwardmonth (window.parent.document.all." Inputbox.name "," Now_Year "," Now_MONTH "," Now_Day ") /"> "; FrameContent =" </ TD> / N "; FrameContent =" <TD Valign = Middle Align = 'Center' Width = '16 '> "; FrameContent = now_month; framecontent =" </ td> / n ";</p> <p>FrameContent = "<TD VALIGN = Middle Align = 'center' width = '13 '>"; FrameContent = "Month"; FrameContent = "</ TD> / N"; FrameContent = "<TD Width = 8>"; FrameContent = "<img src = 'inc / . gif' width = '8' Height = '11 'border =' 0 'alt =' Next" οnclick = / "parent.nextmonth" οnclick = / "parent.nextmonth Window.Parent.document.all. " inputbox.name ", " now_year ", " now_MONTH ", " Now_Day ") / ">"; FrameContent = "</ TD>" "/ n"; FrameContent = "</ tr>" "/ n"; framecontent = "</ table>" "/ n"; framecontent = "<table lonselectstart = /" Return False; / "border = '0' cellpadding = '0 'cellspacing =' 1 'width =' 100% 'bgcolor =' # ccccc '> " " / n "; framecontent =" <tr bgcolor =' # f5f5f5 '> " " / n "; framecontent =" <TD > <center> 1 </ center> </ td> " " / n "; framecontent =" <td> <center> 2 </ center> </ td> " " / n "; framecontent =" <TD > <center> 3 </ center> </ td> " " / n "; framecontent =" <td> <center> 4 </ center> </ td> " " / n "; framecontent =" <TD > <center> 5 </ center> </ td> "/ n"; framecontent = "<td> <center> six </ center> </ td>" "</p> <p>/ N "; FRAMECONTENT =" <TD> <center> <font color = '# ff0000'> Japan </ font> </ center> </ td> "/ n"; framecontent = "</ TR>" "/ n"; // If the first day this month is Monday or Sunday. Add seven. Guaranteed the date IF (FW <2) TF = FW 7; Else TF = fw FrameContent = "<tr bgcolor = '# ffffff'>" "/ n"; // The first line last month FOR (L = (LD-TF 2); l <= ld; l ) {FrameContent = "<td οnclick = /" Parent.ForwardMonth (window.parent.document.all. " inputbox.name ", " now_year ", " now_month ", " L ") / "Style = 'Cursor: Hand' > <center> <font color = '# bbbbbb'> l "</ font> </ center> </ td>" "/ n"; w ;} // First line this month date for (f = TF; f <= 7; f ) {// Sunday but non-input date IF ((w% 7) == 0) && (D! = now_day)) FrameContent = "<td onmouseover = /" this.style . background = / '# e1e1e1 /' / "onmouseout = /" this.style.background = / '# ffffff /' / "onclick = /" parent.inputValue (window.parent.document.all. " InputBox.name "," Now_year "," D "); Parent.hiddenCalendar () /" style = 'cursor: hand'> <center> <font color = '# ff0000'> D "< / font> </ center> </ td> " " / n "; // day Period, ELSE IF (D == Now_DAY) FrameContent = "<TD Style =</p> <p>/ "background: # 420042; cursor: hand /" onclick = / "parent.inputValue (window.parent.document.all." inputbox.name "," now_month "," D ") Parent.hiddencalendar () / "> <center> <font color = '# ffffff'>" D "</ font> </ center> </ td>" "/ n"; // Other Else FrameContent = "<td onmouseover = /" this.style.background = / '# e1e1e1 /' / "onmouseout = /" this.style.background = / '# ffffff /' / "onclick = /" parent.inputValue (window.parent .Document.all. " inputBox.name ", " now_year ", " d "); Parent.hiddenCalendar () / "style = 'cursor: hand'> <center> d " </ center> </ td> " " / n "; D ; w ;} framecontent =" </ TR> " " / n "; w = 1; for (i = 2; i <7; i ) {FrameContent = "<tr bgcolor = '# ffffff'>" "/ n"; for (j = 1; j <8; j ) {if (isnd) / / date FrameContent = "<TD Style = 'Cursor: Hand' οnclick = / "parent.nextmonth (window.parent.document.all." inputbox.name "," now_MONTH "," D ") /"> <center> <font color = '# bbbbbb'> d </ font> </ center> </ td> " " / n "; Else // Date of this month {// Sunday but non-input date IF ((w% 7) =</p> <p>= 0) && (D! = Now_day)) FrameContent = "<TD onMouseOver = /" this.style.background = / '# e1e1e1 /' / "onMouseout = /" this.style.background = / '# ffffff /' / "onclick = /" parent.inputValue (window.parent.document.all. " inputbox.name ", " now_MONTH ", " D "); Parent.hiddencalendar () / "style = 'CURSOR: HAND'> <center> <font color = '# ff0000'> " D " </ font> </ center> </ td> " " / n "; // is the input date else IF D == now_day) FrameContent = "<TD style = /" background: # 420042; cursor: hand / "onclick = /" parent.inputValue (window.parent.document.all. " inputbox.name ", " now_year " "/ n"; // other else framecontent = "<td onmouseover = /" this.Style.Background = / '# e1e1e1 /' / "onmouseout = /" this.style.background = / '# ffffff /' / "onclick = /" parent.inputValue (window.parent.document.all. " inputbox.name ", " now_MONTH ", " D "); Parent.hiddencalendar () / "style = ' CURSOR: HAND '> < Center> " D " </ center> </ td> " " / n ";} // Judgment is the date IF of this month (D ==</p> <p>TD) {ISND = true; d = 0;} W ; D ;} framecontent = "</ tr>" "/ n";} framecontent = "</ table>" "/ n"; framecontent = "< Table overselectStart = / "return false; /" cellpadding = '0' cellspacing = '0' bgcolor = '# f5f5f5' width = '100%' height = '15 '> " " / n <Tr> / n "; FrameContent = "<TD Title = /" Today: " GetTodayDate () " / "style = /" cursor: hand / "οnclick = /" parent.settodaydate (window.parent.document.all. " InputBox.name ") /"> "; FRMECONTENT =" <font color = red> Today: </ font> " GetTodayDate (); framecontent =" </ td> / n "; framecontent =" <TD> "; FrameContent =" <img src = 'inc / close.gif' width = '13 'height = '13' border = '0' alt = 'Close' Style = 'Cursor: Hand' οnclick = / "parent.hiddencalendar () /">> "FrameContent =" </ td> / n "; FrameContent =" </ TR> / N "; Document.all.Calendar.innerHTML = framecontent; document.all.calendar.style.display =" ";} / * Display input box * / function dateBox (sboxname, sdfltvalue) {if (sboxname == null) sboxName = 'date_box' ix ((sdfltvalue == null) ||! (Dateistrue (sdfltValue)) SDFLTVALUE = GE TTODAYDATE () Else {datestr = SDFLTVALUE.SPLIT ("-"); y = parsefloat (datestr [0]); m = (Parsefloat (datestr [1]) <10)? ('0' </p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-23491.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="23491" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.039</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'r5k_2BhmPLJENCX_2BY4YXm8POWSMovuI0u4w7rdrfdt5Ye9zkDXwgRlyjShgHews9nDdEVnfxmDmvzNQXb1y_2BbLxA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>