Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<script>
function applyDate() {
// SET THE VAR TO HOLD THE FORM
var Gm = document.formname;
// CREATE A NEW DATE
var Gm_date = new Date();
// GET THE MONTH
var Gm_month = Gm_date.getMonth();
Gm_month = Gm_month + 1;
// GET THE DATE
var Gm_day = Gm_date.getDate();
// GET THE YEAR
var Gm_year = Gm_date.getFullYear();
//IF THE CHECKBOX IS CLICKED...
if(Gm.Gm_test.checked == true) {
// POPULATE THE TEXTAREA WITH THE DATE
Gm.Gm_date.value = Gm_month +'/'+ Gm_day +'/'+ Gm_year;
// MAKE IT READONLY SO THE USER CANNOT UPDATE/MODIFY THE DATE
Gm.Gm_date.readOnly = true;
return false;
}
}
</script>
<table>
<tr>
<td>
<form name="formname">
<input name="Gm_test" type="checkbox" value="date" onClick="return applyDate();">
<input type="text" name="Gm_date" value="">
</form>
</td>
</tr>
</table>
<script>
function applyDate() {
// SET THE VAR TO HOLD THE FORM
var Gm = document.formname;
// CREATE A NEW DATE
var Gm_date = new Date();
// GET THE MONTH
var Gm_month = Gm_date.getMonth();
Gm_month = Gm_month + 1;
// GET THE DATE
var Gm_day = Gm_date.getDate();
// GET THE YEAR
var Gm_year = Gm_date.getFullYear();
[COLOR=red]
//IF THE CHECKBOX IS CLICKED...
if(Gm.Gm_test.checked == true) {
// POPULATE THE TEXTAREA WITH THE DATE
Gm.Gm_date.value = Gm_month +'/'+ Gm_day +'/'+ Gm_year;
// MAKE IT READONLY SO THE USER CANNOT UPDATE/MODIFY THE DATE
Gm.Gm_date.readOnly = true;
[COLOR=blue][b]//return false;[/b][/color]
}[/color][COLOR=green]
//IF THE CHECKBOX IS UNCHECKED, THE FIELD IS NULL...
if(Gm.Gm_test.checked == false) {
// CLEAR THE TEXTAREA WITH THE DATE
Gm.Gm_date.value = "";
// MAKES READONLY FALSE SO THE USER CAN UPDATE/MODIFY THE DATE MANUALLY
Gm.Gm_date.readOnly = false;
}[/color]
}
</script>