Hello, i am very angry. I wrote this code. Partially it works fine in Firefox but not in one case (which is almost the same as others).
It all works in IE.
This is the code:
onclick=”if (this.value == 1) {
if (getElementById(‘start_date’).value.substring(3,5) <= 6) {
if (parseInt(getElementById(‘start_date’).value.substring(3,5)) + 6 <= 9) {
getElementById(‘end_date’).value =
getElementById(‘start_date’).value.substring(0,2) + ‘-‘ +
‘0’ + String(parseInt(getElementById(‘start_date’).value.substring(3,5)) + 6) + ‘-‘ +
getElementById(‘start_date’).value.substring(6,10);
} else {
getElementById(‘end_date’).value =
getElementById(‘start_date’).value.substring(0,2) + ‘-‘ +
String(parseInt(getElementById(‘start_date’).value.substring(3,5)) + 6) + ‘-‘ +
getElementById(‘start_date’).value.substring(6,10);
}
} else {
//it does not work here
getElementById(‘end_date’).value =
getElementById(‘start_date’).value.substring(0,2) + ‘-‘ +
‘0’ + String(parseInt(getElementById(‘start_date’).value.substring(3,5)) – 6) + ‘-‘ +
String(parseInt(getElementById(‘start_date’).value.substring(6,10)) + 1);
}
}
else {
if (this.value == 2) {
period = 1;
}
else {
period = 2;
}
getElementById(‘end_date’).value =
getElementById(‘start_date’).value.substring(0,2) + ‘-‘ +
getElementById(‘start_date’).value.substring(3,5) + ‘-‘ +
String(parseInt(getElementById(‘start_date’).value.substring(6,10)) + period);
}”