<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
</style>
<script type="text/javascript">
var base = [15,100,200,300,400,500,600,700,800,1000];
var time = [1,2,5,6,7,];
var a = [
[130,115,104,89,83,75,75,69,67,63],
[167,140,125,103,93,85,79,77,75,69],
[200,167,160,118,105,95,87,84,81,75],
[234,192,183,132,120,100,95,91,89,79],
[267,218,206,146,139,110,101,98,95,85],
[300,244,230,160,150,120,108,105,101,92]
];
$(document).ready(function (){
(function (){
var o=$('#s1');
var i;
o.append('<option value=""></option>')
for (i=0; i<time.length; i++) {
o.append('<option value="'+i+'">'+time[i]+'</option>')
};
o=$('#s2')
o.append('<option value=""></option>')
for (i=0; i<base.length; i++) {
o.append('<option value="'+i+'">От '+base[i]+'</option>')
};
})();
$('select').change(function (){
var s1=$('#s1').val();
var s2=$('#s2').val();
if (s1==''||s2=='') return;
$('#itg').text(a[s1][s2]);
});
});
</script>
</head>
<body>
<select id='s1'></select>
<select id='s2'></select>
<p>Итого: <span id='itg'></span></p>
</body>
</html>
Вроде работает
|