променливите в js-то имат същите имена както id-тата на полетата. това бърка ИЕ
В отговор на:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Systems Calculator</title>
<script type="text/javascript">
search = window.location.href.substr( window.location.href.indexOf( "&count=" ) + 1 )
count=6;
var sum;
function calc2()
{
var neto=0
for (g = 1; g < count; g++)
{
if (parseInt(document.getElementById('r'+g).value) >= 0)
{
fira = parseFloat(document.getElementById("outgo_fira2").value);
amount = parseFloat(document.getElementById("amount2").value);
proda = parseFloat(document.getElementById('r'+g).value);
sum_fira=parseFloat(proda+(proda*(fira/100)));
document.getElementById('f'+g).innerHTML = sum_fira.toFixed(2) + ' xx.';
sum = parseFloat(((amount*proda)*fira/100)+(amount*proda));
document.getElementById('a'+g).innerHTML = sum.toFixed(2) + ' xx.';
price=document.getElementById('p'+g).value;
sum_calc=parseFloat(sum*price);
document.getElementById('c'+g).innerHTML = sum_calc.toFixed(2) + ' xx.';
neto=neto + sum_calc;
}
}
amount=document.getElementById("amount2").value;
montaj_fira=parseFloat(document.getElementById("montaj_fira2").value);
montaj_amount=parseFloat(amount*montaj_fira);
document.getElementById("montaj_amount2").innerHTML=montaj_amount.toFixed(2) + ' xx.';
montaj_cena=parseFloat(document.getElementById("montaj_cena2").value);
montaj_sum=parseFloat(montaj_amount*montaj_cena);
document.getElementById("montaj_sum2").innerHTML=montaj_sum.toFixed(2) + ' xx.';
neto=parseFloat(neto+montaj_sum);
document.getElementById("neto2").innerHTML=neto.toFixed(2) + ' xx.';
document.getElementById("single2").innerHTML=(neto/amount).toFixed(2) + ' xx.';
document.getElementById("neto_dds2").innerHTML=(neto*(20/100)).toFixed(2) + ' xx.';
document.getElementById("single_dds2").innerHTML=((neto/amount)*(120/100)).toFixed(2) + ' xx.';
document.getElementById("final_sum2").innerHTML=(neto*(120/100)).toFixed(2) + ' xx.';
document.getElementById("final_count2").innerHTML=amount;
}
</script></head><body>
<center>
<h1>System Test</h1><table border="1" cellpadding="0" cellspacing="0" width="700">
<thead>
<tr>
<th width="20%">xxxxxxxxxxxx</th>
<th width="5%">xxxxx</th>
<th width="15%">xxxxxxxx xxxxx</th>
<th bgcolor="yellow" width="15%">xxxxxx x xxxx
;<input id="outgo_fira2" size="4" type="text">%</th>
<th bgcolor="yellow" width="10%">xxxxxxxxxx
;<input id="amount2" value="4" size="4" type="text"></th>
<th width="15%">xx. xxxx
;xx</th>
<th width="20%">xxxx
;xx</th></tr>
</thead><tbody><tr>
<td align="center">cat_child</td>
<td align="center">cm2</td>
<td align="center" bgcolor="yellow"><input id="r1" name="r1" size="4" value="0" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="f1" align="center"> </td>
<td id="a1" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="p1" name="p1" size="4" value="8" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="c1" align="center"> </td>
</tr><tr>
<td align="center">test1</td>
<td align="center">m2</td>
<td align="center" bgcolor="yellow"><input id="r2" name="r2" size="4" value="0" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="f2" align="center"> </td>
<td id="a2" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="p2" name="p2" size="4" value="15" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="c2" align="center"> </td>
</tr><tr>
<td align="center">pop</td>
<td align="center">m2</td>
<td align="center" bgcolor="yellow"><input id="r3" name="r3" size="4" value="0.9" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="f3" align="center"> </td>
<td id="a3" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="p3" name="p3" size="4" value="12" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="c3" align="center"> </td>
</tr><tr>
<td align="center">okok</td>
<td align="center">cm2</td>
<td align="center" bgcolor="yellow"><input id="r4" name="r4" size="4" value="0" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="f4" align="center"> </td>
<td id="a4" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="p4" name="p4" size="4" value="6.9" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="c4" align="center"> </td>
</tr><tr>
<td align="center">lol</td>
<td align="center">m3</td>
<td align="center" bgcolor="yellow"><input id="r5" name="r5" size="4" value="1.3" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="f5" align="center"> </td>
<td id="a5" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="p5" name="p5" size="4" value="7.85" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="c5" align="center"> </td>
</tr><tr>
<td align="center">xxxxxx</td>
<td align="center">xx.x.</td>
<td align="center">1 xx.</td>
<td align="center" bgcolor="yellow"><input id="montaj_fira2" value="1" size="4" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="montaj_amount2" align="center"> </td>
<td align="center" bgcolor="yellow"><input id="montaj_cena2" value="1" size="4" onkeyup="javascript:calc2();" type="text"> xx.</td>
<td id="montaj_sum2" align="center"> </td>
</tr></tbody><tfoot>
<tr>
<th colspan="3"><font size="2">xxxxxxxx xx xxxx x xxxxxxxx xx xxxxxxxx xxxxx xx xx.x. xxx xxx</font></th>
<th> </th>
<th id="single2"> </th>
<th>xxxx xxxx</th>
<th id="neto2"> </th>
</tr>
<tr>
<th colspan="3"><font size="2">xxxxxxxx xx xxxx x xxxxxxxx xx xxxxxxxx xxxxx xx xx.x. x xxx</font></th>
<th> </th>
<th id="single_dds2"> </th>
<th>20% xxx</th>
<th id="neto_dds2"> </th>
</tr>
<tr>
<th colspan="3"><font color="red" size="2">xxxxxxxxx: xxxxxxxx xxxxxx xx 'xxxxxxx'. xxxxxxxxx xx xx xx xxxxxxxxx xxxxxxxxxx</font></th>
<th> </th>
<th>xxxx xx</th>
<th id="final_count2"> </th>
<th id="final_sum2"> </th>
</tr></tfoot></table></center>
<a href="javascript:calc2();">proba</a>
</body></html>
Редактирано от ghs на 07.02.07 13:37.