General discussion

Locked

making the date appear in a text box

By btrnart ·
Hi guys,

Could anyone please tell me how I can make the date display in a text box with the following attributes. <input name="Arrival" type="text" class="formtxtfield" size="20" maxlength="10">.

I'm sure it is quite simple but I just can't do it.

Thanx.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by rashmigopinath In reply to making the date appear in ...

Hi,
The following code snippet should solve your purpose:
<html>
<body onload="getDate()">
<script language="JavaScript" type="text/javascript">
function getDate(){
var myDate = new Date();
document.myForm.myText.value=myDate;
}
</script>
<form name="myForm">
<input type="text" name="myText" size="20">
</form>
</body>

You can have various date formats too by changing the date format in the myDate variable.

Rgds,
Rashmi.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums