<input type="hidden" name="shijian" id="shijian" style="width:250px" class="intxt" value="">我这里的表单如何获取当前js获取的时间<script language="JavaScript">
function getDate()
{
var today = new Date();
var date;
date = (today.getFullYear()) +"年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日-" + today.toLocaleTimeString();
return date;
}
</script>
function getDate()
{
var today = new Date();
var date;
date = (today.getFullYear()) +"年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日-" + today.toLocaleTimeString();
return date;
}
</script>
<script language="JavaScript">
function getDate()
{
var today = new Date();
var date;
date = (today.getFullYear()) +"年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日-" + today.toLocaleTimeString();
return date;
}
window.onload = function(){
document.getElementById('shijian').value = getDate();
};
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<form>
<input type="text" id="shijian" style="width:250px" value="" />
</form>
<script>
function getDate(){
var today = new Date();
var date;
date = (today.getFullYear()) +"年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日-" + today.toLocaleTimeString();
return date;
}
window.onload = function(){
var input = document.getElementById("shijian");
setInterval(function(){
input.value = getDate();
}, 1000);
}
</script>
</body>
</html>