function creditRes() {
var creditGetImage = document.getElementById("itemImage").innerHTML;
document.getElementById("showItemImage").innerHTML = creditGetImage;
var creditGetItemTitle = document.getElementById("creditTitle").innerHTML;
document.getElementById("showCreditTitle").innerHTML = creditGetItemTitle;
var creditGetPrice = document.getElementById("mainprice").innerHTML;
var creditResultShow = (creditGetPrice / 2) / 3 + " грн/мес.";
var creditResultShowSecond = creditGetPrice / 3 + " грн/мес.";
document.getElementById("newprice").innerHTML = "При первом взносе 50% 3 платежа по: " + creditResultShow;
document.getElementById("newsecondprice").innerHTML = "Оплата 3 равными платежами по: " + creditResultShowSecond;
document.getElementById("cartPrice").innerHTML = "Стоимость: " + creditGetPrice + " грн.";
}
<li>
<div id="itemImage"><img src="http://matari.ua/images/generator/m3800e/m3800e-main.jpg" style="width: 200px;" alt=""></div>
<h5 id="creditTitle" class="genn">Matari M7000E (5.5 кВт) </h5>
<div class="unit ratings">
<div class="rate rate-5"></div>
<div class="otz">Отзывов (24)</div>
<div class="clear"></div>
</div>
<div class="product-panel fp">
<div class="unit price-row">
<div id="mainprice">20250</div>
<div class="item-order">
<div class="pp-price-status-block">
<div class="pp-price-status pp-price-status-available ">Есть в наличии</div>
<button name="buy_details" onclick="creditRes();" class="ibutton-css-green button success goto change-to-details">Выбрать</button>
</div>
</div>
</div>
</li>
<li>
<div id="itemImage"><img src="http://matari.ua/images/generator/bs7000e/bs7000e-main.jpg" style="width: 200px;" alt=""></div>
<h5 id="creditTitle" class="genn">Matari BS9000E (6.5 кВт) </h5>
<div class="unit ratings">
<div class="rate rate-5"></div>
<div class="otz">Отзывов (3)</div>
<div class="clear"></div>
</div>
<div class="unit price-row">
<div id="mainprice">24300</div>
<div class="item-order">
<div class="pp-price-status-block">
<div class="pp-price-status pp-price-status-available ">Есть в наличии</div>
<button name="buy_details" onclick="creditRes();" class="ibutton-css-green button success goto change-to-details">Выбрать</button>
</div>
</div>
</div>
</li>
<div style="width:100%; height: 200px;">
<div style="float:left; border-right: 1px solid #e6e6e6; height: 200px; padding-right: 20px;">
<div id="showItemImage"></div>
</div>
<div style="display: inline-block; margin-left: 40px">
<div id="showCreditTitle"></div>
<div id="cartPrice"></div>
<input type="radio"> <div id="newprice"></div></input>
<div style="padding-top: 10px;">
<input type="radio"> <div id="newsecondprice"></div></input>
</div>
</div>
</div>
document.querySelectorAll('.change-to-details').forEach(function (element) {
element.addEventListener('click', function (event) {
creditRes(event.target.parentNode.parentNode.parentNode.parentNode.parentNode);
});
});
onclick="creditRes();"
var $li = document.querySelector('li#li-index-' + $attr_data_with_index);
function creditRes($li) {
var creditGetImage = $li.querySelector(".itemImage").innerHTML;
document.getElementById("showItemImage").innerHTML = creditGetImage;
var creditGetItemTitle = $li.querySelector(".creditTitle").innerHTML;
document.getElementById("showCreditTitle").innerHTML = creditGetItemTitle;
var creditGetPrice = $li.querySelector(".mainprice").innerHTML;
var creditResultShow = (creditGetPrice / 2) / 3 + " грн/мес.";
var creditResultShowSecond = creditGetPrice / 3 + " грн/мес.";
document.getElementById("newprice").innerHTML = "При первом взносе 50% 3 платежа по: " + creditResultShow;
document.getElementById("newsecondprice").innerHTML = "Оплата 3 равными платежами по: " + creditResultShowSecond;
document.getElementById("cartPrice").innerHTML = "Стоимость: " + creditGetPrice + " грн.";
}