一、在自定义表单中添加字段 添加时间字段 timesj 二、在调用表单的页面中加入 input name=timesj value= type=hidden id=timesj style=width:250px; class=intxt / script type=text/javascript window.onload = function() […]
<input name="timesj" value="" type="hidden" id="timesj" style="width:250px;" class="intxt" /> <script type="text/javascript"> window.onload = function(){ var nowDate = new Date(); var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds(); document.getElementById("timesj").value=str; } </script>或者
<input type="hidden" name="timesj" id="timesj" value="{dede:php} echo $showtime=date('Y-m-d H:i:s');{/dede:php}" />
<input type="hidden" name="timesj" id="timesj" /> <script language="javascript" type="text/javascript"> var wdtime= new Date(); document.getElementById("timesj").value=wdtime.toLocaleString(); </script>以上表单中使用了type=hidden,所以是隐藏模式。
if($fielddata[1]=='datetime') { $fields[$field] = GetDateTimeMk($fields[$field]); }经过以上三步的处理,用户在前台填表后,管理后台就能看到用户添加的时间了。