Click to See Complete Forum and Search --> : Hidden Field
huntemup
12-18-2002, 12:46 PM
I am developing a site for a mortgage company. One of the pages on the site is an on-line mortgage application. I am trying to insert a hidden field with the value equal to the current date so I can pass the value into our database. Can someone help me with a script to complete this. Thanks
Hello,
note that it is better to get the date with ServerSide languages like PHP or Asp etc.
In javascript you can make it this way:
<html>
<head>
<title>Date</title>
<meta name="author" content="Swon">
<script language="JavaScript">
<!--
function datum(){
var jetzt = new Date();
var t = jetzt.getDate();
var m = jetzt.getMonth();
var j = jetzt.getYear();
var h = jetzt.getHours();
var mi = jetzt.getMinutes();
var dat = (t + "." + m + "." + j + " " + "Zeit" + h + ":" + mi)
document.date.mydate.value=dat;
//and the next field to proof it;
document.date.showdate.value=dat;
//if you want not all of it, change var dat string above;
}
//-->
</script>
<noscript></noscript>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#FF0000" alink="#FF0000" vlink="#FF0000"onLoad="datum();">
<form name="date">
<input type="hidden" name="mydate" value="">
<input type="text" name="showdate" value="">
</form>
</body>
</html>
huntemup
12-18-2002, 01:01 PM
Could you help me with the script to obtain the date in .ASP
Thanks
Sorry, my Knowledge is in PHP and not in ASP