有不少用戶都需要在織夢(mèng)留言上面增加一個(gè)關(guān)于用戶提交留言的時(shí)間,好區(qū)分用戶什么時(shí)候提交的留言?,F(xiàn)織夢(mèng)模板之家技術(shù)鐘振森給大家分享一個(gè)簡(jiǎn)單的增加留言時(shí)間。
首先自定義表單,然后添加字段,
比如聯(lián)系人(單行文本),聯(lián)系方式(單行文本),地址(單行文本),留言內(nèi)容(單行文本),留言時(shí)間(單行文本)等字段
注意:留言時(shí)間這里不要選擇“時(shí)間類型”,選擇默認(rèn)的“文本形式”就可以。
自定義表單在模板中修改如下:
-
<form action="/plus/diy.php" enctype="multipart/form-data" method="post" name="form" onsubmit="return CheckForm();">
-
<input type="hidden" name="action" value="post" />
-
<input type="hidden" name="diyid" value="1" />
-
<input type="hidden" name="do" value="2" />
-
提交時(shí)間
-
<input name="mytime" value="" type="text" id="mytime" /><!-- 如不需要在前臺(tái)顯示的話可以修改type="hidden" -->
-
<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("mytime").value=str;
-
}
-
</script>
-
<input type="hidden" name="dede_fields" value="mytime,textchar" />
-
<input type="hidden" name="dede_fieldshash" value="849a871768b5942ee259e8f7af736194" />
-
<label><input class="btn_tj" type="submit" name="Submit" value=" 提交" /></label>
-
</form>
注明:當(dāng)然這上面的代碼是可以調(diào)用的。像這邊測(cè)試的一個(gè)就像這樣子。
這個(gè)是為顯示的時(shí)間,如果自己不想他顯示的
-
<input name="mytime" value="" type="text" id="mytime" /><!-- 如不需要在前臺(tái)顯示的話可以修改type="hidden" -->
好了目前大工完成。
