Показать сообщение отдельно
  #2 (permalink)  
Старый 14.06.2013, 11:22
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

obscurant,

<!DOCTYPE HTML>
<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script>
    $(function () {
		var sum = 0;
		$("#product_table .price").each( function () {
			sum += parseInt( $(this).text(), 10 ) * parseInt( $(this).next().text(), 10 )
		});
		alert(sum);
     });
</script>


 </script>
</head>

<body>
<table id="product_table">
<tr>
<td class="price">364.00</td>
<td class="quantity">3</td>
</tr>
<tr>
<td class="price">900.00</td>
<td class="quantity">2</td>
</tr>
<tr>
<td class="price">450.00</td>
<td class="quantity">1</td>
</tr>

</table>
</body>
</html>
Ответить с цитированием