<script> function id(){ var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var s = now.getSeconds(); var timeValue=""; timeValue+=h; timeValue+=m; timeValue+=s; document.form1.up_file_id.value=timeValue; document.form1.up_file_id1.value=timeValue; } </script> <form name="form1" method="post"> <input name="up_file_id"><input type=button onclick="id()" value="iddd"> <input name="up_file_id1" type="hidden"> </form>
我在IE5中不能使用id函数,id是关键字,要换一个函数名称, <script> function id1(){ var now = new Date(); var h = now.getHours(); var m = now.getMinutes(); var s = now.getSeconds(); var timeValue=""; timeValue+=h; timeValue+=m; timeValue+=s; document.form1.up_file_id.value=timeValue; document.form1.up_file_id1.value=timeValue; } </script> <form name="form1" method="post"> <input name="up_file_id"><input type=button onclick="id1()" value="iddd"> <input name="up_file_id1" type="hidden"> </form>
使用parseInt将字符转换成整数 不过这样有什么用?
var today = new Date(); var v_year = today.getYear(); var v_month = today.getMonth(); var v_hour = today.getHours(); var v_min = today.getMinutes(); var v_sec = today.getSeconds(); 俺现在还不知道如何提取毫秒的时间,大侠指点。
function id(){
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
var timeValue="";
timeValue+=h;
timeValue+=m;
timeValue+=s;
document.form1.up_file_id.value=timeValue;
document.form1.up_file_id1.value=timeValue;
}
</script>
<form name="form1" method="post">
<input name="up_file_id"><input type=button onclick="id()" value="iddd">
<input name="up_file_id1" type="hidden">
</form>
其实我不是要得到当前系统时间hh:mm:ss,而是得到hhmmss这样的数值。
<script>
function id1(){
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
var timeValue="";
timeValue+=h;
timeValue+=m;
timeValue+=s;
document.form1.up_file_id.value=timeValue;
document.form1.up_file_id1.value=timeValue;
}
</script>
<form name="form1" method="post">
<input name="up_file_id"><input type=button onclick="id1()" value="iddd">
<input name="up_file_id1" type="hidden">
</form>
不过这样有什么用?
var v_year = today.getYear();
var v_month = today.getMonth();
var v_hour = today.getHours();
var v_min = today.getMinutes();
var v_sec = today.getSeconds(); 俺现在还不知道如何提取毫秒的时间,大侠指点。