jquery вывод значения
Доброго времени суток, срочно требуется ваша помощь :help:
В js не силён, есть скрипт, который обрабатывает значение 3 инмпутов(1 инмпут может отсутствовать(display:none)). Дальше скрипт обрабатывает два чек бокса , у которых есть значение. Суть. сумму инпуты скрипт умножает на их значение, а в зависимости от чек бокса плюсует или вычитает от их суммы значение чекбокса.
$(document).ready(function() {
$("#check").change(function() {
var formOftype = $("#check");
formOftype.live("change",function() {
var totalSum = 0,
totalSumNDS = 0,
$("#inputCell").each(function() {
var inputCell = parseInt($("#inputCell").val()) * parseInt($("#inputCell").attr("name"));
totalSum += inputCell ;
});
$("#inputCellk").each(function() {
var inputCellk = parseInt($("#inputCellk").val()) * parseInt($("#inputCellk").attr("name"));
totalSum += inputCellk ;
});
$("#inputCellm").each(function() {
var inputCellm = parseInt($("#inputCellm").val()) * parseInt($("#inputCellm").attr("name"));
totalSum += inputCellm ;
});
$(this + "input[name='k'] :checked").each(function() {
totalSum += parseInt($(this).val());
});
$("#price-window").text(totalSum);
});
});
});</script>
|
Цитата:
|
не выводит
|
Цитата:
|
<div id="var">
<form id = "type">
<div class="var-left"><div class="var-ins"><img src="type1" height="87px" width="127px"/></div> Г-образный левый</br><input type="radio" name="formcheckbox" value="0"> </div>
<div class="var-right"><div class="var-ins"><img src="type2" height="87px" width="127px"/></div> Г-образный правый</br><input type="radio" name="formcheckbox" value="1"></div>
<div class="var-left"><div class="var-ins"><img src="type3" height="87px" width="127px"/></div> прямой</br> <input type="radio" name="formcheckbox" value="2"> </div>
<div class="var-right"><div class="var-ins"><img src="type4" height="87px" width="127px"/></div> П-образный </br> <input type="radio" name="formcheckbox" value="3"></div>
</form>
</div><form id="type">
<div id="config_site"><!-- config_site -->
<div class="s-var">
<div id="fd-st">
<div class="form-c">
<div class="form-title">Длинна A </div>
<div class="form-ins"><input type=text name="style1" id="inputCell" value="" style="width:102px;height:19px" maxsize=""></div>
</div>
<div class="form-c" id="nxt-1">
<div class="form-title"> Длинна B </div>
<div class="form-ins"><input type=text name="style2" id="inputCellk" value="" style="width:102px;height:19px" maxsize=""></div>
</div>
<div class="form-c" id="nxt-2" style="display: none">
<div class="form-title" id="fi" > Длинна C </div>
<div class="form-ins" id="fiok" ><input type=text name="style2" id="inputCellm" value="" style="width:102px;height:19px" maxsize=""></div>
</div>
</div>
<div id="s-var-ins"><img src="2.jpg" height="234px" width="338px"/></div>
</div>
</div><!-- config_site/ -->
</div>
<div id="middle-z">
<div class="title-s" id="ttl"> выберите фурнитуру и столешницу </div>
<div class="itm-strages">
<div class="itm" id="itm-st">
<div class="itm-window"><img src="<?echo $furn["1"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["1"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["1"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["2"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["2"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["2"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["3"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["3"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["3"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["4"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["4"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["4"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window">
<input type=hidden value="<?echo $rec['count']?>" name = "con"><img src="<?echo $furn["5"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["5"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["5"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["6"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["6"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["6"]["con"]?>" /></div><!-- description -->
</div>
</div>
<div class="itm-strages">
<div class="itm" id="itm-st">
<div class="itm-window"><img src="<?echo $furn["7"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["7"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["7"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["8"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["8"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["8"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["9"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["9"]["comment"]?></br><input type="radio" name="rB" value="<?echo $furn["9"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["10"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["10"]["comment"]?></br><input type="radio" name="st" value="<?echo $furn["10"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["11"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["11"]["comment"]?></br><input type="radio" name="st" value="<?echo $furn["11"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["12"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["12"]["comment"]?></br><input type="radio" name="st" value="<?echo $furn["12"]["con"]?>" /></div><!-- description -->
</div>
</div>
<div class="itm-strages">
<div class="itm" id="itm-st">
<div class="itm-window"><img src="<?echo $furn["13"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["13"]["comment"]?></br><input type="radio" name="st1" value="<?echo $furn["13"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"> <input type=hidden value="100" name = "k"><img src="<?echo $furn["14"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["14"]["comment"]?></br><input type="radio" name="st2" value="<?echo $furn["14"]["con"]?>" /></div><!-- description -->
</div>
<div class="itm">
<div class="itm-window"><img src="<?echo $furn["15"]["photo"]?>" width="101px" height="101px"/></div>
<div class="desc"><?echo $furn["15"]["comment"]?></br><input type="radio" name="st3" value="<?echo $furn["15"]["con"]?>" /></div><!-- description -->
</div>
</div>
<div class="b-ttl"> Рассчитать без фурнитуры (все данные элементы включены в базовую комплектацию гарнитура) <input type='checkbox' name='-1000' style="margin-top:2px;" value='0'></div>
</div>
<div id="bottom-z">
<div class="title-s" id="ttl"> выберите услуги </div>
<div id="fac"> Сборка кухни <input type='checkbox' name='k' style="margin-top:2px;" value='3500'> </div>
<div id="fnl">
</form>
<div id="price-window"></div><!-- поле вывода цены -->
<div id="calc-button"><a href="рассчет"><div class="calc-link"> рассчитать </div></a></div><!-- кнопка расчета -->
<div id="rsp"></div>
<div id="buy-button"><a href="#" OnClick="document.MYFORM.submit(); return false;"><div class="calc-link">заказать</div></a></div><!-- кнопка заказа -->
</form></form>
</div>
</div>
</div><!-- content/ -->
</div><!-- body/ -->
|
| Часовой пояс GMT +3, время: 07:32. |