<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form>
<div class="form-group">
<label>Стоимость</label>
<input type="text" class="form-control3" id="summa" value="1000">
</div>
<div class="form-group">
<label for="amount-sample-4">Страна:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="rossia" value="0" checked>
<label class="form-check-label" for="rossia">
Россия
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios" id="drstrana" value="600">
<label class="form-check-label" for="drstrana">
Другая страна
</label>
</div>
</div>
<div class="form-group">
<label for="name-sample-4">Адрес:</label>
<div>
<input id="name-sample-4" required="" placeholder="" class="form-control" type="text" value="Walter" size="30">
</div>
</div>
<div class="form-group">
<label for="amount-sample-4">Доставка:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios1" id="pochta" value="600" checked>
<label class="form-check-label" for="pochta">
Почта России
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="exampleRadios1" id="kurier" value="0">
<label class="form-check-label" for="kurier">
Курьерская доставка
</label>
</div>
</div>
<button id="calc">Посчитать</button> <!-- Добавил кнопку для пересчета с новыми значениями -->
<br />
<br />
<div>Стоимость дизайна сайта: <span id="result">0</span> руб.</div>
</form>
<script src="s.js"></script>
</body>
</html>
var button = document.getElementById("calc");
button.addEventListener('click', calc);
function calc(e) {
e.preventDefault(); // запретить действие по умолчанию, иначе скрипт не будет работать
var result = document.getElementById("result");
var summa = document.getElementById("summa");
var rossia = document.getElementById("rossia");
var drstrana = document.getElementById("drstrana");
var pochta = document.getElementById("pochta");
var kurier = document.getElementById("kurier");
var price = 0;
summa = parseInt(summa.value);
rossia = rossia.checked ? parseInt(rossia.value) : 0;
drstrana = drstrana.checked ? parseInt(drstrana.value) : 0;
pochta = pochta.checked ? parseInt(pochta.value) : 0;
kurier = kurier.checked ? parseInt(kurier.value) : 0;
price = summa + rossia + drstrana + pochta + kurier;
result.innerHTML = price;
}
<ul>
<li><span>Стоимость:</span><span class="price">47250₽</span> <s>67400 ₽</s></li>
<li><span>В рассрочку:</span><span>3938₽/мес</span>.</li>
<li><span>Скидка:</span><span class="discount">50%</span></li>
</ul>
ul{
list-style: none;
}
ul > li{
margin: 1rem;
}
ul > li > span:first-child{
display: inline-block;
width: 150px;
}
.discount {
background: #ffd873;
padding: 4px;
border-radius: 4px;
color: blue;
}
import_rand = False
if import_rand:
import random
print(int(random.randrange(10)))
elif not import_rand:
print(int(random.randrange(10)))
import subprocess
cmd = 'python script.py'
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
out, err = p.communicate()
result = out.split('\n')
for lin in result:
if not lin.startswith('#'):
print(lin)