<input type="text" id="showtime" redayonly="redayonly" /> <script> function nowGetTime(){ var date=new Date(); document.getElementById("showtime").value=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds(); } window.setInterval("nowGetTime()",1000); </script>