Click to See Complete Forum and Search --> : I cant lock the date


96turnerri
09-09-2003, 08:59 AM
hi this is what i have so far it displays the current date in an online form box

<head>
<SCRIPT LANGUAGE="JavaScript">
function StartDate() {
TDay = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
TMonth = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
TDate = new Date();
CurYear = TDate.getYear();
CurMonth = TDate.getMonth();
CurDayOw = TDate.getDay();
CurDay= TDate.getDate();
TheDate = TDay[CurDayOw] + ', ';
TheDate += TMonth[CurMonth] + ' ';
TheDate += CurDay + ', ';
if (CurYear < 2000) CurYear = CurYear + 1900;
TheDate += CurYear;
document.CForm.CDate.value = TheDate;
}
</SCRIPT>
</head>

<BODY onLoad="StartDate()";>

<FORM NAME="CForm">
<TABLE>
<TD><INPUT TYPE="text" NAME="CDate" SIZE="27"></TD>
</TABLE>
</FORM>
</body>

but the user can delete the data in the box, i found a script yesterday to lock it but i cant find it now, its on this site, if someone knows it can they plz let me no

pyro
09-09-2003, 09:04 AM
Something like this:

<input type="text" disabled="disabled">

96turnerri
09-09-2003, 09:08 AM
thanks i found another way add this to the input onFocus="this.blur()

96turnerri
09-09-2003, 09:09 AM
<INPUT TYPE="text" NAME="CDate" SIZE="27" onFocus="this.blur()">

pyro
09-09-2003, 09:10 AM
That way won't work, however, if the user has javascript disabled...

96turnerri
09-09-2003, 09:13 AM
it works for me

96turnerri
09-09-2003, 09:16 AM
to get to see this date online form box, they must have java enabled because its in a java popup

pyro
09-09-2003, 09:56 AM
I guess I personally just perfer to not use javascript whenever possible...