Доброго времени суток, подскажите, как сохранить значение???
Вот такой скрипт:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
<script type="text/javascript">
function changeText(){
var bill1 = 0;
var bill = 0;
var fullbill = 0;
var fullbill1 = document.getElementById('fullbill1').value;
var firstAccount = document.getElementById('firstAccount').options[document.getElementById('firstAccount').selectedIndex].value;
var firstPc = document.getElementById('firstAccount').options[document.getElementById('firstAccount').selectedIndex].id;
bill1 = parseFloat(fullbill1);
bill1 = bill1-bill1*parseFloat(firstPc)/100;
bill = bill1;
fullbill = parseFloat(fullbill1);
document.getElementById('bill1').innerHTML = bill1;
document.getElementById('bill').innerHTML = bill;
document.getElementById('fullbill').innerHTML = fullbill;
}
</script>
и к нему вот такая процедура выбора:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
<form onsubmit="return false;">
<input class ="value-tt3" type="float" id="fullbill1" name="fullbill1" value="{$post.fullbill1|escape}" oninput="changeText()">
<select id="firstAccount" name="account1" onchange="changeText()">
<option value="1" id={$accnpc1} {if $post.account1 == '1'}selected="selected"{/if}>{$accn1} -{$accnpc1}%</option>
<option value="2" id={$accnpc2} {if $post.account1 == '2'}selected="selected"{/if}>{$accn2} -{$accnpc2}%</option>
<option value="3" id={$accnpc3} {if $post.account1 == '3'}selected="selected"{/if}>{$accn3} -{$accnpc3}%</option>
<option value="4" id={$accnpc4} {if $post.account1 == '4'}selected="selected"{/if}>{$accn4} -{$accnpc4}%</option>
<option value="5" id={$accnpc5} {if $post.account1 == '5'}selected="selected"{/if}>{$accn5} -{$accnpc5}%</option>
</select> = <output id="bill1">{$bill1}</output> <text>руб</text>
</form>
И все вроде бы работает, но {$bill1} корректно только отображается на экране, а как сохранить полученное значение?
Что-нибудь типа
1.
<input class ="hidden" id="bill1" name="bill1" value="{$bill1}" >