Forum Moderators: open
I have a simple table with some form items in it.
But two radio buttons, one input and two labels are not working the way I want them to work...
Here's the code of the table:
-----------------------------------------------------------
<table class="description">
<tr>
<td>
<label class="req">Tipo Pago:</label><br />
<input type="radio" id="con_ret" onclick="calculate(document.getElementById('total_hon').value);" name="tipo_p" checked="checked" />
<label for="con_ret">Con Retención</label>
<input type="radio" id="sin_ret" onclick="calculate(document.getElementById('total_hon').value);" name="tipo_p" />
<label for="sin_ret">Sin Retención</label>
</td>
</tr>
<tr>
[.. some td's..]
</tr>
<tr>
<td><label for="total_hon" class="req">Total Honorario:</label></td>
<td>
<input type="text" id="total_hon" name="total_hon" size="10" onkeyup="calculate(this.value);" />
</td>
</tr>
<tr>
<td><label>10% Retención:</label></td>
<td><label id="retencion">0</label></td>
</tr>
<tr>
<td></td>
<td><hr /></td>
</tr>
<tr>
<td><label>Honorarios Líq.:</label></td>
<td><label id="hon_liq">0</label></td>
</tr>
</table>
----------------------------------------------------------
And here's the code for the javascript function i'm using:
----------------------------------------------------------
function calculate(value){
var condition = document.getElementById('sin_ret');
var percent_label = document.getElementById('retencion');
var liquido = document.getElementById('hon_liq');
if(value==''){
alert('empty!');
percent_label.textContent = '0';
liquido.textContent = '0';
}
else if(condition.checked==true && value!=''){
alert('no retention');
var honorario = parseFloat(value);
percent_label.textContent = '0';
liquido.textContent = honorario+'';
}
else if(condition.checked==false && value!=''){
alert('retention set!');
var honorario = parseFloat(value);
var retention = honorario*10/100;
var resta = honorario-retention;
percent_label.textContent = retention+'';
liquido.textContent = resta+'';
}
}
----------------------------------------------------------
This form, and the javascript function works perfectly fine in FF (windows and linux) but not in IE. The weird thing is than in IE(and of course in FF) all the alert() method in the script shows when they are supposed to. But the script does not set the new values for the labels.
What's wrong in my code?
Thank you