mercredi 31 décembre 2014

Logic for implementing output of a function to another function


I have 2 input check boxes and a select list. what i want to do is, whenever a checkbox is selected, a certain amount is added into the element with the "amount" as id. The basic product price is 6000 and whenever a checkbox is selected, a certain amount is added to that basic product price. This goes the same for select box which has 10 input values. Each value is multiplied with 600 and the result is then added in the element with "amount" as id.


Check out the JSFiddle for the complete understanding.



http://ift.tt/1EJMDeg


This is what i tried for the select box.



function ep(t)
{
// addedprice = 0;
var addedprice = t.value * 600;
total = total + addedprice;
// total = 6000 - total;
document.getElementById('total').innerHTML = " (+) "+ addedprice;
loginer = document.getElementById('login').checked;
profer = document.getElementById('prof').checked;
if(t.value > 0)
{
// total = total + addedprice;
if(wpress)
{
wp(addedprice);
}
if(blogger)
{
blog(addedprice);
}
if(loginer)
{
login(addedprice);
}
if(profer)
{
prof(addedprice);
}
}

document.getElementById('amount').value =6000 + total;
total = 6000 + total;
document.getElementById('amount').value = total;
}


I need to implement this in Javascript.





Aucun commentaire:

Enregistrer un commentaire