The answer depends on your date format:
for more details look at:
http://www.w3schools.com/j
Main Topics
Browse All TopicsI need to disable inputfield "status" and checkbox "checkbox" if current time date month year hours minutes (GMT) is equal or more than time displayed in inputfield "SalesClose"
<form action="testresult.html" method="get">
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td><input name="SalesClose" type="text" value="25.02.2007 14:55 " readonly="true" /></td>
<td><input name="status" type="text" value="H" /></td>
<td><input name="checkbox" type="checkbox" disabled value="" /></td>
</tr>
</table>
</form>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The answer depends on your date format:
for more details look at:
http://www.w3schools.com/j
You will find what you need in here:
http://www.mattkruse.com/j
Nushi.
Here is a full working solution for you.
simply download the JS file and change the src location in the script section.
<!-- Download the JS frile from:
http://www.mattkruse.com/j
-->
<script src="http://www.mattkruse.
Now: <script>document.write( new Date() )</script><br>
<form action="testresult.html" method="get">
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td>
<!-- input id="dateValue" name="SalesClose" type="text" value="25.02.2007 14:55" readonly="true" / -->
<select id="dateValue" name="SalesClose" onchange="setFields()">
<option value="25.02.2007 14:55">25.02.2007 14:55</option>
<option value="26.02.2007 14:55">26.02.2007 14:55</option>
<option value="27.03.2007 14:55">27.03.2007 14:55</option>
<option value="28.04.2007 14:55">28.04.2007 14:55</option>
</select>
</td>
<td>
<input id="field1" name="status" type="text" value="H" />
</td>
<td>
<input id="field2" name="checkbox" type="checkbox" value="" />
</td>
</tr>
</table>
<script>
var DATE_FORMAT = "dd.MM.yyyy HH:mm";
function $( id ){
return document.getElementById( id);
}
function setFields(){
// Get the date now
var now = new Date();
// Convert the date to the given format
var newDate = '';
newDate += (now.getDate() < 10 ? '0' : '') + now.getDate() + '.';
newDate += (eval(now.getMonth() + 1 ) < 10 ? '0' : '') + eval(now.getMonth() + 1 ) + '.';
newDate += now.getFullYear();
newDate += ' ' + (now.getHours() < 10 ? '0' : '') + now.getHours() + ':';
newDate += (now.getMinutes() < 10 ? '0' : '') + now.getMinutes();
// If you dont use the above date format - simply change the format
var dateValue = $( 'dateValue' ).value;
if ( compareDates( dateValue, DATE_FORMAT, newDate, DATE_FORMAT) > 0 ){
$( 'field1' ).disabled = false;
$( 'field2' ).disabled = false;
}
else{
$( 'field1' ).disabled = true;
$( 'field2' ).disabled = true;
}
}
</script>
</form>
Nushi.
Business Accounts
Answer for Membership
by: NushiPosted on 2007-02-28 at 05:32:04ID: 18624647
Create a nee Date Object and compare it to the given value.
then use disabled =true when needed
var now= new Date()
if ('your_field_object'>now)
...
else
...
Nushi.