<html>
<head>
<script type="text/javascript">
function mydate(){
var time=new Date();
var year=time.getFullYear();
var hour=time.getHours();
var mon=time.getMonth()+1;
var day=time.getDate();
var minu=time.getMinutes();
var sec=time.getSeconds();
hour=change(hour);
minu=change(minu);
sec=change(sec);
document.getElementById("dat").innerHTML=year+"-"+mon+"-"+day+" "+hour+":"+minu+":"+sec;
t=setTimeout("mydate()",500);
}
function change(num){
if(num<10){
return "0"+num;
}
else{
return num;
}
}
</script>
</head>
<body onload="mydate()">
<div id="dat"></div>
</body>
</html>
限制Android的EditText输入文字时换行