61,129
社区成员




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test<title>
<script type="text/javascript">
window.onload= function(){
document.getElementById("t").onclick = function() {
document.getElementById("now").value = new Date().toLocaleString();
};
};
</script>
</head>
<body>
<input value="reset" type="reset" id="t" />
<input type="text" id="now" />
</body>
</html>
<form name="form1" method="post" action="">
<input type="text" name="txt" id="txt">
<input name="reset" type="button" id="reset" onClick="showDate()" value="重置">
</form>
<script>
function showDate()
{
var today = new Date();
var day = today.getDate();
var month = today.getMonth() + 1;
var year = today.getYear();
var mytime=today.toLocaleTimeString();
var date = year + "-" + month + "-" + day + " " + mytime;
document.getElementById("txt").value = date;
}
</script>