JS 获取时间 之后加入 文本框中?
<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="utf-8"%>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>采购入库</title>
</head>
<script type="text/javascript" language="javascript">
function clockon(bgclock){
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
var date=now.getDate();
var hour=now.getHours();
var minu=now.getMinutes();
var sec=now.getSeconds();
month=month+1;
if(month<10) month="0"+month;
if(date<10) date="0"+date;
if(hour<10) hour="0"+hour;
if(minu<10) minu="0"+minu;
if(sec<10) sec="0"+sec;
var time="";
time="pt"+year+month+date+hour+minu+sec;
if(document.all){
bgclock.innerHTML="pt"+time
}
document.getElementById("bgclock").value=time;
}
</script>
<body onLoad="clockon(bgclock)">
<table width="100%" border="1">
<tr>
<td>
<form action="" method="post">
<table width="100%" border="1">
<tr>
<th colspan="4" align="left" scope="col">采购入库单</th>
</tr>
<tr>
<td width="9%">入库单号</td>
<td width="19%" ><input type="text" name="purchasingThe.imptGrnnumber" id="bgclock" /></td>
<td width="14%">采购批次</td>
<td width="58%"><input type="text" name="purchasingThe.imptPurchaseBatch" id="purchasingThe.imptPurchaseBatch" /></td>
</tr>
<tr>
<td>备注</td>
<td colspan="3"><textarea name="purchasingThe.imptNote" id="purchasingThe.imptNote" cols="70" rows="5"></textarea></td>
</tr>
</table></form>
这样写 取不到值啊 但是 id写在TD中就可以取到值 那样我就无法就如数据库了 求解决...
------解决方案--------------------
<body onLoad="clockon('bgclock')">