Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

RegisFurtado

Colocar a data do sistema em um campo "text"

Recommended Posts

facil ...function newDate(){ var _d,y,m,d _d = new Date(); y = _d.getFullYear(); m = ((_d.getMonth()+1)+"").length == 1?("0"+(_d.getMonth()+1)):_d.getMonth()+1; d = (_d.getDate()+"").length == 1?("0"+_d.getDate()):_d.getDate(); return (d+"/"+m+"/"+y);};campo.value = newDate();fiz umas coisas de cabeça mas deve funcionar :)

Compartilhar este post


Link para o post
Compartilhar em outros sites

facil ...function newDate(){ var _d,y,m,d _d = new Date(); y = _d.getFullYear(); m = ((_d.getMonth()+1)+"").length == 1?("0"+(_d.getMonth()+1)):_d.getMonth()+1; d = (_d.getDate()+"").length == 1?("0"+_d.getDate()):_d.getDate(); return (d+"/"+m+"/"+y);};campo.value = newDate();fiz umas coisas de cabeça mas deve funcionar :)

valeu a ajuda.. vou testar aquiNão funciona...Simplesmente apareçe na minha txt o nomo getDate(); ...

Compartilhar este post


Link para o post
Compartilhar em outros sites

<html><script language="javascript">function newDate(){var _d,y,m,d_d = new Date();y = _d.getFullYear();m = ((_d.getMonth()+1)+"").length == 1?("0"+(_d.getMonth()+1)):_d.getMonth()+1;d = (_d.getDate()+"").length == 1?("0"+_d.getDate()):_d.getDate();return (d+"/"+m+"/"+y);}document.frm.txtData.value=newDate();</script><form name="frm">Data:<input type="text" name="txtData" size="10"></form></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

<html><body><form id="frm">Data:<input type="text" name="txtData" size="10"></form><script language="javascript">function newDate(){var _d,y,m,d_d = new Date();y = _d.getFullYear();m = ((_d.getMonth()+1)+"").length == 1?("0"+(_d.getMonth()+1)):_d.getMonth()+1;d = (_d.getDate()+"").length == 1?("0"+_d.getDate()):_d.getDate();return (d+"/"+m+"/"+y);}document.getElementById('frm').txtData.value = newDate();</script></body></html>

funcionou!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.