en altta Totalcost var hepsini yazdırabiliyorum ama hosting switch tıklayınca radio butonlar aktif oluyor seçim yapıncada totalcost değer giriliyor. ama hosting checkbox unchecked yapınca değer yazmaya devam ediyor yani
hosting check box tıklayınca radio checkbox clear nasıl yapabilirim yada totalcostta göstermessin
teşekkürler şimdiden
<html>
<body>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function checkTotal() {
var total = 0;
for (i=0;i<document.project.item.length;i++) {
if (document.project.item[i].checked) {
total = total + parseInt(document.project.item[i].value);
}
}
document.getElementById('Totalcost').innerHTML = total;
};
</script>
<script type="text/javascript">
function Switch() {
var HostingSwitch = document.getElementsByClassName('HostingSwitch');
if (!HostingSwitch[0].checked)
{
$("input[type=radio]").attr('disabled', true);
}
else
{
$("input[type=radio]").attr('disabled', false);
$("input[type=radio]").attr('checked', false);
}
}
window.onload = Switch;
</script>
</head>
<form name="project">
<input type="checkbox" id="item" name="ThemeSwitch" value="20" onclick="checkTotal()"/>Tema<br/>
<input type="checkbox" id="item" name="DomainSwitch" value="50" onclick="checkTotal()"/>Domain<br/>
<input type="checkbox" id="item" class="HostingSwitch" name="HostingSwitch" value="0" onclick="Switch();Status();"/>Hosting<br/>
<input type="radio" class="Packages" id="ExampleTrigger" name="HostingPackages" value="100" onchange="checkTotal()"/>Economic<br/>
<input type="radio" class="Packages" id="item" name="HostingPackages" value="150" onchange="checkTotal()"/>Professional<br/>
<input type="radio" class="Packages" id="item" name="HostingPackages" value="600" onchange="checkTotal()"/>Bussiness<br/>
<input type="checkbox" id="item" name="BackupSwitch" value="100" onclick="checkTotal()"/>Backup<br/>
<input type="checkbox" id="item" name="DesignSwitch" value="230" onclick="checkTotal()"/>Design<br/>
Total: <div id="Totalcost"/><br/>
<script>
function Status() {
var checkBox = document.getElementById("status");
var text = document.getElementById("text");
if (checkBox.checked == true){
text.style.display = "block";
} else {
text.style.display = "none";
}
}
</script>
</form>
</body>
</html>