<script type=”text/javascript”>
function CalculateTotal(){
var p=document.percent.govt_share_capital.value;
var k=document.percent.total_paid.value;
var total=(p/k);
var gtotal=total*100;
//var lll=<?php //echo $gtotal; ?>;
//alert(lll);
}
</script>
<form id=”percent” name=”percent”>
<table>
<tr>
<td>Government share capital out of total paid up share capital</td>
<td><input type=”text” name=”govt_share_capital” id=”govt_share_capital” /></td>
<td>Total Paid up share capital</td>
<td><input type=”text” name=”total_paid” id=”total_paid” /></td>
<td>Percentage of Government share capital to total paid up share capital</td>
<td>
<input type=”text” name=”gtotal” id=”gtotal” value=”<?php echo $lll; ?>” onclick=”javascript:CalculateTotal();”/>
</td>
</tr>
<?php $total = “<script language=javascript>document.write(gtotal);</script>”;
echo $total; ?>
</table>
</form>
Hi,
can anyone please help me for solve this query. I want the function should take input from the 2 fields i.e.govt_share_capital &total_paid and show the percentage in the “gtotal” field on click without page refresh that too in the same page without submitting the form.
thnks…. please help me!!!