开发者

JS Date output into Hidden Text Field

I am using datejs (see www.datejs.com) to work out date and time for tomorrow (24 hours into the future) and output the date into hidden text box to be inserted into db.

This is the code:

<script type="text/javascript">
// submitted
var d1 = Date.today().add(1).days();
document.write(d1.toString('d MMMM yyyy')); //Need to change this to MYSQL format
</script>

<input name="referral_to_be_accepted_by" type="text" value="" id="referral_to_be_accepted_by"/>

At the moment the date (need to add time as well) is shown in doc, but nee开发者_开发问答d to put it in the text box?

Thank you.


try document.getElementById("referral_to_be_accepted_by").value = d1.toString('d MMMM yyyy');

Edit:

<input name="referral_to_be_accepted_by" type="text" value="" id="referral_to_be_accepted_by"/>
<script type="text/javascript">
// submitted
var d1 = Date.today().add(1).days();
document.getElementById("referral_to_be_accepted_by").value = d1.toString('d MMMM yyyy'); //Need to change this to MYSQL format
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜