Este artigo descreve a implementação de um seletor de data que é preciso para segundos por JS. Compartilhe -o para sua referência, como segue:
<Cript> // A função de chamada principal é o setday (this, [object]) e setday (this). [Objeto] é o nome de controle em saída pelo controle. Dê dois exemplos: // 1. <Nome de entrada = txt> <Tipo de entrada = Valor do botão = Setday OnClick = "Setday (this, document.all.txt)"> // 2. <Input onfocus = "setday (this)"> var BmovAcle = true; var strframe; document.Writeln ('<fRame iddddddTin = absoluto; Z-Index: 9998; #63A3E9 1px Solid; cor de fundo: #63A3E9; Font-Family: 安安;} '; strframe+=' td {font-size: 9pt; font-frigene: 安安安;} '; strframe+=' </style> '; strframe+=' <scr '' '' '; DataLayerx, DateLayery; '; strframe+=' var bdrag; '; strframe+=' função document.onmouseMove () '; strframe+=' {if (bdrag && window.event.button == 1) '; strframe+=' {var datelayer = parent.Docent.Document.Document.Document.Document ==) '; Datelayer.posleft+= window.event.clientx-datelayerx; '; strframe+=' datelayer.postop+= window.event.clienty-datelayery;}} '; strframe+=' função dragstart () '; strframe+=' {var Datelayer = parent.document.all.enddatelayer.style; '; strframe+=' datelayerx = window.event.clientx; '; strframe+=' datelayery = window.event.clienty; '; strframe+=' bdrag = true;} '; strframe+=' Dragnd () {'; strframe+=' bdrag = false;} '; strframe+=' </scr '+' ipt> '; strframe+=' <div style = "z-index: 9999; posição: absoluto; esquerda: 0; topo: 0;" ONSELECTSTART = "Return false"> '; strframe+=' <span id = tmpselectyearlayer style = "z-index: 9999; posição: absoluto; topo: 3; esquerda: 19; display: nenhum"> </span> '; strframe+=' <span id = tmselectHorMonthlayer estilo = "zearnex; Nenhum "> </span> '; strframe+=' <span id = tmpselEcthourLayer style =" z-index: 9999; posição: absoluto; topo: 188; 77px; exibição: nenhum "> </span> '; strframe+=' <span id = tmpselectSecondlayer style =" z-index: 9999; posição: absoluto; topo: 188; borderColor =#63A3E9 BGCOLOR =#63A3E9> '; strframe+=' <tr> <td width = 142 altura = 23 bgcolor =#fffff> '; strframe+=' <tabela borda = 0 célula = 1 célula = 0 width = 158 altura = 23> '' '; <td width = 16 align = Center bgcolor = #63a3e9 style = "font-size: 12px; cursor: hand; cor: #ffffff" '; strframe+=' onclick = "parent.meizzprevm ()"> <b> <</b> </td> '; bgcolor = "#63A3e9" style = "font-size: 12px; cursor: hand" '; strframe+=' onMouseOver = "style.backgroundColor =/'#aaccf3/'" '; strframe+=' OnMouseout = "Style.BackgroundColor =/'#63a3e9 ONCLICK = "parent.tmpselectyearinnerhtml (this.innerText.substring (0,4))" '; strframe+='> <span id = meizzyearhead> </span> </td> '; strframe+=' <td width = 48 align = "center" estilo = "FUNCHETENDENTETEL: '; strframe+=' bgcolor = "#63A3e9" onMouseOver = "style.backgroundColor =/'#aaccf3/'" '; strframe+=' onMouseout = "style.back.backgroundColor =/'#63A3E9/' '; OnClick = "parent.tmpselectmonthinnerhtml (this.innertext.length == 3? this.innertext.substring (0,1): this.innerText.substring (0,2))" '; strframe+='> <span Id = meizizhenhead> </spange> </td>; bgcolor = #63a3e9 alinhe = center style = "font-size: 12px; cursor: Hand; cor: #ffffff" '; strframe+=' OnClick = "parent.meizznextm ()"> <b>> </b> </td> '; strframe+=' </tr>; </tabela> </td> </tr> '; strframe+=' <tr> <td width = 142 altura = 18> '; strframe+=' <borda da tabela = 0 CellPacing = 0 CellPadding = 2 bgcolor =#63a3e9 '+(bmovUsable?') BorderColorlight =#63A3E9 BorderColordark =#ffffffffff width = 140 altura = 20 style = "cursor: ' + (bmovable?' Move ':' default ') +' '' ''; strffff + = '<tr> <td style =" font-size: 12px; color: #ffff "" whth =' <td style = "font-size: 12px; color: #ffff" " style = "font-size: 12px; cor: #ffffff"> um </td> <td style = "font-size: 12px; cor: #ffffff"> t </td> '; strframe+=' <td style = "font-size: 12px; cor: #ffff"> um </td> style = "Fonte-tamanho: 12px; cor: #ffffff"> t </td> '; strframe+=' <td style = "font-size: 12px; cor: #ffffff"> um </td> <td style = "font-size: 12px; cor: #ffff"> um </td> '; style = "Fonte-tamanho: 12px; cor: #ffffff"> seis </td> <td style = "font-size: 12px; cor: #ffffff"> seis </td> <td style = "font-size: 12px; cor: #fffffffffff </td </td </tr> '; > '; strframe+=' <tr> <borda da tabela = 1 celular de célula = 2 CellPadding = 2 borderColorlight =#63a3e9 borderColordark =#fffff bgcolor =#fff8ec largura = 140 altura = 120> '; var n = 0; for (j = 0; j <5; j ++) {strframe+= '<tr align = Center>'; para (i = 0; i <7; i ++) {strframe+= '<td width = 20 altura = 20 id = meizzday'+n+'style = "font-size: 12px" onclick = parent.meizzdayclick (this.innerText, 0)> </td>'; n ++; (i = 35; i <37; i ++) strframe+= '<td width = 20 altura = 20 id = meizzday'+i+'style = "font-size: 12px" onclick = "parent.meizzdayclick (th this.innerText, 0)"> </td>'; strfram+= '<t) OnClick = "parent.setNull ()" style = "font-size: 12px; cursor: Hand" '; strframe+=' onMouseOverover = "style.color =/'#ff0000/'" onMouseout = "style.color =/'#1478eb/'"> vazio </splan> <ndcll) style = "font-size: 12px; cursor: Hand" '; strframe+=' onMouseOver = "style.color =/'#ff0000/'" onMouseout = "style.color =/'#1478eb/'"> atual </span = "style =" hand: hand "id = eVaverkk/' onmouseout = "style.color =/'#1478Eb/'" onclick = "parent.cloSelayer ()"> feche </span> </td> </tr> '; strframe+=' </tabela> </td> </tr> <tr> <Td> '; bgcolor =#ffffff altura = 22> '; strframe+=' <tr bgcolor = "#63A3e9"> <td id = busetimelayer width = 30 style = "cursor: manutenção" '; strframe+=' onMouseover = "style.back.backgroundColor =/'#aaccf3; onmouseout = "style.backgroundColor =/'#63A3e9/'" '; strframe+=' onclick = "parent.usetime (this)"> '; strframe+=' </span> </td> '; strframe+=' <td style = " OnClick = "parent.tmpselecThourinnerhtml (this.innerText.length == 3? this.innertext.substring (0,1): this.innertext.substring (0,2))" '; strframe+=' OnMouseover = "Style.backgroundcolor =/'Aacc onmouseout = "style.backgroundcolor =/'#63A3e9/'" '; strframe+=' align = width = 42> '; strframe+=' <span iD = meizzhourhead> </span> </td> '; strframe+=' <TD Style = "Cursor: manual" OnClick = "parent.tmpselectMinuteInnerhtml (this.innertext.length == 3? this.innertext.substring (0,1): this.innertext.substring (0,2))" '; onmouseout = "style.backgroundColor =/'#63A3e9/'" '; strframe+=' align = largura central = 42> '; strframe+=' <span iD = meizzminutehead> </span> </td> '; OnClick = "parent.tmpselectSecondinnerhtml (this.innertext.length == 3? this.innertext.substring (0,1): this.innertext.substring (0,2))" '; strframe+=' onMouseover = "Style.back.backcolor =/'aCl. onmouseout = "style.backgroundColor =/'#63A3e9/'" '; strframe+=' align = largura central = 42> '; strframe+=' <span id = meizizsecondhead> </span> </td> '; strframe+=' </tr> </td> </tr> </tabela> </div> '; window.frames.enddatelayer.document.writeln (strframe); window.frames.enddatelayer.document.close (); // Resolva o problema que a barra de progresso do IE não end//================================================================================================================= ============================================================== ============================================================== Exibição da página da web Parte ============================================================== ================================================================== ================================================================== ================================================================== ================================================================== ================================================================== ================================================================== ================================================================== odatelayer = window.enddatelayer.document.all; // odatelayer.busetimelayer.innertext = "não"; bimgswitch (); odatelayer.buseTimeLayer.innerhtml = bimg; função; Parâmetros foram transmitidos para este controle! "); retornar;} if (argumentos.Length == 0) {alert (" Desculpe! Você não passou nenhum parâmetros de volta a este controle! "); retornar;} var dads = document.all.enddatelayer.style; // O ponto de posicionamento do controle TT é alto var eles = tt.clientHeight; // O alto VAR do próprio controle TT é tleft = tt.OffsetLeft; // O ponto de posicionamento do controle TT é amplo var ttyp = tt.type; // O tipo de controle TT é enquanto (tt = tt.offsetParent) {ttop+= tt.offsetTop; tleft+= tt.offsetLeft;} dads.top = (ttyp == "imagem")? ttop+thei: ttop+thei+6; dads.left = tleft; outObject = (argumentos.length == 1)? th: obj; overbutton = (argumentos.length == 1)? nulo: Th; // Defina o botão externo Clicked // Mostrar o ano e o mês do ano var =/^(/d+)-(/d {1,2})-(/d {1,2})/; // excluindo o tempo var r = outsObject.value.match (reg); if (r! = Null) {r [2] = r [2] -1; var d = nova data (r [1], r [2], r [3]); if (d.getlyear () == r [1] && d.getMonth () == r [2] && d.getDate () == r [3]) {tobado = d; parent.meizzheyear = r [1]; parent.meizzthemonth = r [2]; parent.meizzThedate = r [3]; } else {tobado = ""; } MeizzSetday (r [1], r [2] +1);} else {touthate = ""; mezizsetday (new date (). obtlyear (), new Date (). getMonth () + 1);} dads.display = ''; // julga se o tempo de uso é usado durante a inicialização, verificação não strict // if (usobject.value.length> 10) // {Busetime = true; bimgswitch (); odatelayer.busetimelayer.innerhtml = bimg; mezzwritehead (meizzheyear, meizzthemonth); //} // else // {// BUSETIME = false; // bimgswitch (); // odatelayer.busetimelayer.innerhtml = bimg; // mezizwritehead (mezzheyearen, miezhemonnha); (e) {// O erro foi excluído aqui, a causa do erro ainda não foi encontrada. }} var monsh = nova matriz (12); // Defina o número máximo de dias por mês no calendário gregoriano MONHEND [0] = 31; Monhead [1] = 28; MONHEN [2] = 31; MONHEN [3] = 30; Monhead [4] = 31; MONHEN [5] = 30; Monhead [6] = 31; MONHEN [7] = 31; Monhead [8] = 30; MONHEN [9] = 31; Monhead [10] = 30; MONHEN [11] = 31; var meziztheyear = new Date (). Getlyear (); // Defina o valor inicial da variável do ano var MeizzThemonth = new Date (). GetMonth ()+1; // Defina o valor inicial da variável do mês var Meizzedate = new Date (). GetDate (); // Defina o valor inicial da variável do dia var MeizztheHour = new Date (). Gethours (); // Defina o valor inicial da variável de hora var MeizzThemInute = new Date (). GetMinutes (); // Defina o valor inicial da variável minuto var MeizzTheSecond = new Date (). GetSeconds (); // Defina o valor inicial da segunda variável var MeizzWDAY = new Matriz (37); // Array que define o documento de data da data.OnClick = (function () {with (window.event) {if (srcelement! = OutObject && srcelement! = Outbutton) closeLayer ();}}) document.onkeyup = (function) {if (window.event.Keycode == 27) {) closelayer ();} else if (document.activeElement) {if (document.activeElement! "Ano"; odatelayer.meizzmonthhead.innerText = formato (mm)+"lua"; // Insira a hora e o minuto de minuto e minuto odatelayer.meizzhourhead.innerText = BUSTETIME? minutos "):" "; odatelayer.meizzSecondhead.innerText = BUSTIME? (MeizzTheSecond+" segundos "):" ";} função tmpselectyearinnerhtml (stryear) // caixa suspensa para ano (if (stryear.match (// d/)! número! "); retornar;} var m = (stryear)? stryear: new date (). obtlyear (); if (m <1000 || m> 9999) {alert ("o valor do ano não está entre 1000 e 9999!"); return;} var n = m - 50; if (n <1000) n = 1000; if (n + 101> 999) N = 997; 12px '"s +=" onblur =' document.all.tmpselectyearlayer.style.display =/"none/" '"s +=" onchange =' document.all.tmpeleclectyearlayer.style.display = this/"Nenhum/"; parent.meizzsetday (parent.meizzheyear, parent.meizzthemonth) '>/r/n "; var selectinnerhtml = s; for (var i = n; i <n + 101; i ++) {if (i == m) {selectinner INSL + =" <pption value =' "" + " + i" "" "'' '' '' '' '' '' '' '' '' '' '; } else {selectInnerhtml + = "<opção value = '" + i + "'>" + i + "ano" + "</pption>/r/n"; }} SelectInnerhtml += "</leclect>"; odatelayer.tmpselectyearlayer.style.display = ""; odatelayer.tmpselectyearlayer.innerhtml = selectinnerhtml; tmpSelectMonthinnerHtml (strmonth) // Caixa de puxar para o mês {if (strmonth.match (// d/)! = null) {alert ("O parâmetro de entrada do mês não é um número!"); retornar;} var m = (strmond)? strmonth: new Date (). getMonth () +1; var s = "<selecione nome = tmpselectmonth style = 'font-size: 12px'" s += "onblur = 'document.all.tmpselectmonthlayer.style.display =/" Nenhum/"'" S += = = = S += "Onnchange = 'document.all.tmpselectmonthlayer.style.display =/" none/";" s+= "parent.meizzthemonth = this.value; parent.meizzsetDay (parent.meizzheear, parent.mezzthemon)/r/r/n"; (i == m) {selectinnerHtml+= "<opção value = '"+i+"' selected>"+i+"mês"+"</pption>/r/n"; } else {selectInnerhtml+= "<opção value = '"+i+"'>"+i+"mês"+"</pption>/r/n"; }}selectInnerHTML += "</select>";odatelayer.tmpSelectMonthLayer.style.display="";odatelayer.tmpSelectMonthLayer.innerHTML = selectInnerHTML;odatelayer.tmpSelectMonth.focus();}/***** Add hours and minutes***/function tmpselEcthourinnerhtml (strhour) // caixa suspensa de hora {if (! BUSETIME) {return;} if (strhour.match (// d/)! = null) {alert ("parâmetros de entrada de horas não são números!"); retornar;} var m = (stramar)? STRHOUR: new Date (). "ONCHANGE = 'document.all.tmpselEcthourlayer.style.display =/" none/";" s+= "parent.meizzthehour = this.value; parent.evasetTime (parent.meizzthehour, parent.meizzththeminute);'>/r/n"; if (i == m) {selectInnerhtml+= "<opção value = '"+i+"' selected>"+i+"</pption>/r/n"; } else {selectInnerhtml+= "<opção value = '"+i+"'>"+i+"</pption>/r/n"; }} SelectInnerhtml += "</select>"; odatelayer.tmpselecthourlayer.style.display = ""; odatelayer.tmpselecThourLayer.innerhtml = selectinnerhtml; odatelayer.tmpselThour.focus.focus.focus.focus (selectInnerhtml; odatelayer.tmpselThour.focus ( tmpSelectMinuteInnerHtml (StrMinute) // Caixa suspensa minuto {if (! strMinute: new Date (). getminutes (); var s = "<selecione nome = tmpselectminute style = 'font-size: 12px'" s += "onblur = 'document.all.tmpselectMinUtelayer.style.display =/" Nenhum/"' 's += = = = "ONCHANGE = 'document.all.tmpselectminUtelayer.style.display =/" none/";" s += "parent.meizztheminute = this.value; parent.evasetTime (parent.meizztheHour, parent.meizhMinute);'>/r/n"; i ++) {if (i == m) {selectInnerhtml+= "<opção value = '"+i+"' selected>"+i+"</pption>/r/n"; } else {selectInnerhtml+= "<opção value = '"+i+"'>"+i+"</pption>/r/n"; }} selectInnerhtml += "</leclect>"; odatelayer.tmpselectminUtelayer.style.display = ""; odatelayer.tmpselectMinUteLayer.innerhtml = selectInnerhtml; odatelayer.tmselectMinMinTinMinUSTMinuMMInTeTMinuTMinuMMInTeTMinuMMinuMMInTeTMinuMMInTeTMInTeTMInTeTMInTeTMInTeTMInTeTMInTeTMInTeTMInTeTMinEstMMINUSTMINUTMINUTMINUTMINUTMMIrtMinEst. tmpSelectSecondinnerHtml (strSecond) // Segunda caixa suspensa {if (! BUSETIME) {return;} if (strSecond.match (// d/)! = null) {alert ("parâmetro de entrada minuto não é um número!") StrSecond: new Date (). "Onnchange = 'document.all.tmpselectSecondlayer.style.display =/" none/";" s += "parent.meizztheSecond = this.value; parent.evasetTime (parent.meizzthehour, parent.meizztheminute, parent.mezizheSecond); 0; } else {selectInnerhtml+= "<opção value = '"+i+"'>"+i+"</pption>/r/n"; }} selectInnerHtml += "</leclect>"; odatelayer.tmpselectSecondlayer.style.display = ""; odatelayer.tmpselectSecondlayer.innerhtml = selectIrhtml; odatelayer.TmSselectSsectSectSectSeCONDSCOND. camada {var o = document.getElementById ("enddatelayer"); if (o! = null) {o.style.display = "nenhum";}} função showLayer () // o fechamento desta camada {document.all.enddatelayer.style.display = "; {document.all.enddatelayer.style.display ="; {document.all.enddatelayer.style.Display = "; (0 == ano%4 && ((ano%100! = 0) || (ano%400 == 0))) retorne true; caso contrário, retorne false;} função getMonthCount (ano, mês) // fevereiro do ano alheado é 29 dias {var c = Monhead [mês-1]; if (mês == 2) && ispinyear ( Dia da semana de um determinado dia {var c = monte [mês-1]; if ((mês == 2) && ispinyear (ano)) c ++; retorna c;} função getDow (dia, mês, ano) // encontre o dia da semana de um determinado dia {var dt = new Data (ano, mês-1, dia). retornar dt;} function meizzprevy () // flip ano {if (meizztheyear> 999 && meizzheyear <10000) {meizztheyear-;} else {alert ("ano fora do alcance (1000-9999)!"); Ano {if (meizztheyear> 999 && meizztheear <10000) {meizzheyear ++;} else {alert ("ano fora do alcance (1000-9999)!");}; // Botão de hoje {parent.meizzheyear = new Date (). Getlyear (); parent.meizzthemonth = new Date (). DATE (). (parent.meizzThedate <10 && parent.meizzhedate.length <2) // formato em dois dígitos {parent.meizzThedate = "0" + parent.meizzTheDate;} // mezizsetday (meizztheear, mezzthemon); formato (parent.meizzthemonth) + "-" + formato (parent.meizzThedate) + "" + formato (parent.meizzthehour) + ":" + formato (parent.meizztheminute) + ":" Format (parent.meizzthesecond); // NOTA: Aqui você pode alterar a saída para o formato que deseja} else {OutObject.value = parent.meizzheyear + "-" + formato (parent.meizzthemonth) + "-" + formato (parent.meizzthedate); //Note: Here you can change the output to the format you want}}closeLayer();}function meizzPrevM() //Follow the month forward{if(meizzTheMonth>1){meizzTheMonth--}else{meizzTheYear--;meizzTheMonth=12;}meizzSetDay(meizzTheYear,meizzTheMonth);}function meizzNextM() //Follow the mês para trás {if (meizzthemonth == 12) {meizzheyear ++; meizzthemonth = 1} else {meizzthemonth ++} mezzsetday (meizzheyear, meizzthemonnth);} // TODO: Organize o código da função ************* {meizzwritehead (yy, mm); // Defina a variável pública do ano e mês atual para passar no valor meizztheyear = yy; meizzthemonth = mm; para (var i = 0; i <37; i ++) {mezizwday [i] = "" "}; // limpe todo o conteúdo da caixa de exibição var day1 = 1, dia2 = 1, primeiro dia = nova data (yy, mm-1,1) .getday (); /Em que dia da semana do primeiro dia de um certo mês para (i = 0; i <primeiro dia; i ++) meizzwday [i] = getMonthCount (mm == 1? Yy-1: yy, mm == 1? 12: mm-1)-primeiro aniversário+i+1 // os últimos dias do mês passado (i primeiro dia; primeiro; meizzwday [i] = dia1; dia1 ++; } para (i = primeiro dia+getMonthCount (yy, mm); i <37; i ++) {meizzwday [i] = dia2; dia2 ++; } para (i = 0; i <37; i ++) {var da = avaliar ("odatelayer.meizzday"+i) // com o acordo de data e semana do novo mês se (mezzwday [i]! = "") {// inicialize o border da.bordercolorlight = "#63A3e9"; da.bordercolordark = "#63A3E9"; da.style.color = "#1478Eb"; if (i <primeiro dia) // a parte do mês passado {da.innerhtml = "<b> <font color =#bcbabc>" + meizzwday [i] + "</font> </b>"; da.title = (mm == 1? 12: mm-1) + "mês" + meizzwday [i] + "dia"; da.OnClick = function ("MeizzdayClick (this.innerText, -1)"); if (! Desboto) da.style.backgroundColor = ((mm == 1? yy-1: yy) == new Date (). getlyear () && (mm == 1? 12: mm-1) == new Date (). "#5CEFA0": "#f5f5f5"; caso contrário, {da.style.backgroundColor = ((mm == 1? yy-1: yy) == toblate.getlyear () && (mm == 1? 12: mm-1) == Ultate.getMonthonth () + 1 && mezzwday [i] == Ultate.getDate ())? "#84c1ff": (((mm == 1? Yy-1: yy) == new date (). Getlyear () && (mm == 1? 12: mm-1) == new Date (). GetMONTH ()+1 && mezzwday [i] == new Date (). // Mostra a data selecionada como côncavo if ((mm == 1? Yy-1: yy) == desbate.getlyear () && (mm == 1? 12: mm-1) == tanquate.getmonth () + 1 && mezzwday [i] == Outbate.getdate ()) {da.bordercollorlight = " da.bordercolordark = "#63A3E9"; }}} else if (i> = primeiro dia + getmonthcount (yy, mm)) // a parte do próximo mês {da.innerhtml = "<b> <font color =#bcbabc>" + mezzwday [i] + "</font> </b>"; da.title = (mm == 12? 1: mm + 1) + "mês" + meizzwday [i] + "dia"; da.OnClick = function ("MeizzdayClick (this.innerText, 1)"); if (! Desbobrado) da.style.backgroundColor = ((mm == 12? yy+1: yy) == new Date (). getlyear () && (mm == 12? 1: mm+1) == new Date (). "#5CEFA0": "#f5f5f5"; else {da.style.backgroundColor = ((mm == 12? yy+1: yy) == tobta.getlyear () && (mm == 12? 1: mm+1) == outbate.getMOMOME ()+1 && mezzwday [i] == Outbate.getDate ())? "#84c1ff": (((mm == 12? Yy+1: yy) == new Date (). Getlyear () && (mm == 12? 1: mm+1) == new Date (). GetMONTH ()+1 && mezzwday [i] == new Date (). /Mostra a data selecionada como côncavo if ((mm == 12? Yy+1: yy) == tobado.getlyear () && (mm == 12? 1: mm+1) == Desbote.getmonth ()+1 && meizzwday [i] == Outdate.getdate ()) {Da.border; da.bordercolordark = "#63A3E9"; }}} else // parte deste mês {da.innerhtml = "<b>" + mezzwday [i] + "</b>"; da.title = mm + "mês" + mezizwday [i] + "dia"; da.OnClick = function ("MeizzdayClick (this.innerText, 0)"); // Dê a TD o processamento do evento OnClick // Se for a data atualmente selecionada, um fundo azul brilhante será exibido; Se for a data atual, um fundo amarelo escuro será exibido se (! Expectar) da.style.backgroundcolor = (yy == new Date (). obtlyear () && mm == new Date (). getMONTH ()+1 && mezizwday [i] == new Date (). "#5CEFA0": "#f5f5f5"; else {da.style.backgroundColor = (yy == UPDATE.getlyear () && mm == Ultate.getMonth () + 1 && meizzwday [i] == Desbate.getDate ())? "#84c1ff": ((yy == new date (). Getlyear () && mm == new Date (). GetMonth ()+1 && meizzwday [i] == new Date (). GetDate ())? "#5cefa0": "#f5f5"); // Mostrar a data selecionada como côncavo se (yy == UPDATE.GETILYEAR () && mm == Ultate.getMonth () + 1 && MeizzWDay [i] == UBLATE.GETDATE ()) {da.BorderColorlight = "#ffffff"; da.bordercolordark = "#63A3E9"; }}} da.style.cursor = "hand"} else {da.innerhtml = ""; da.style.backgroundcolor = ""; da.style.cursor = "padrão"; }}} função meizzdayclick (n, ex) // Clique na caixa de exibição para selecionar a data, a função de entrada principal ************************ {parent.meizzThate = n; var yy = mezzheyear; var mm = parseInt (mezizthemonth)+ex;; // ex representa o deslocamento, usado para selecionar a data do mês anterior e no mês seguinte var hh = meizzthehour; var mi = meizztheminute; var se = meizzthesecond; // julgar o mês e executar o processamento correspondente se (mm <1) {yy--;; mm = 12+mm;} else if (mm> 12) {yy ++; mm = mm-12;} if (mm <10) {mm = "0" + mm;} if (hh <10) {hh = "0" + hh;} // tempo if (mi <10) {mi = "0" + mi;} // minuto se (se <10) {= "0" +; se; //outobject.value= ""; return;} if (n <10) {n = "0" + n;} wridedateto (yy, mm, n, hh, mi, se); closeLayer (); if (BUSTime) {tente {outbutton.Click (); } catch (e) {setday (outObject); }}} else {closeLayer (); alerta ("o objeto de controle que você deseja que a saída não existe!");}} Formato da função (n) // formate o número como caracteres de dois dígitos para representar {var m = new String (); var tmp = new String (n); se (n <10 && tmp.length <2) {m = "0"+n;} {{MEN; M <10 && M = n; Minutos selecionados pelo usuário {odatelayer.meizzhourhead.innerText = meizzthehour+"time"; odatelayer.meizzminutehead.innerText = mezztheminute+"minuto; odatelayer.meizzsecondhead.innertext = mezizheSecond+" Segundos "; WritedateTo (Meizzheyear, Meizzthemonth, Meizzthedate, MeizztheHour, MeizzTheminute, MeizztheSecond)} função evasettimeNothing () // Defina o controle de tempo para empty{odatelayer.meizzHourHead.innerText="";odatelayer.meizzMinuteHead.innerText="";odatelayer.meizzSecondHead.innerText="";WriteDateTo(meizzTheYear,meizzTheMonth,meizzTheDate,meizzTheHour,meizzTheMinute,meizzTheSecond)}function evasettImenow () // Defina o controle de tempo para a hora atual {odatelayer.meizzhourhead.innerText = new Date (). DATE (). DATE () tempo, o tempo selecionado originalmente pelo usuário // evasettimenow (); formato (mm) + "-" + formato (n) + "" + formato (hh) + ":" + formato (mi) + ":" + formato (se); want}} função bimgswitch () {if (BUSTime) {bimg = "on";} else {bimg = "off";}} </script> <input onfocus = "setday (this)" id = "starttime" name = "For more information about JavaScript, please check this site's special topics: "Summary of JavaScript Time and Date Operation Skills", "Summary of JavaScript Switching Effects and Skills", "Summary of JavaScript Search Algorithm Skills", "Summary of JavaScript Animation Special Effects and Skills", "Summary of JavaScript Errors and Debugging Skills", "Summary of JavaScript Data Structures and Algorithm Skills", "Resumo do Algoritmo e Habilidades de Traversal JavaScript" e "Resumo do Uso da Operação Matemática JavaScript"
Espero que este artigo seja útil para a programação JavaScript de todos.