laumbert
Joined: 18 Oct 2016 Posts: 1
|
Posted: Wed Oct 11, 2017 2:06 am Post subject: Hey! I need to add total price on my code. |
|
|
<label for="q9" style="float: left; width: 30%; padding-top: 4px; font-family: Arial; color: #000000; font-size: 14px;"
>Applikasjon 1: </label> <select name="q9" id="q9" id="data-price1" style="font-family: Arial; font-size: 14px; color: #000000; background-color: #FFFFFF; border: 1px solid #000000; padding: 2px;">
<option value="Hosting - Visma Lønn">Hosting - Visma Lønn</option>
<option value="Hosting - Visma Global">Hosting - Visma Global</option>
i can get the total price if i change the value, but then the price show up on the email, not the name of the choise.
can someone help me to add the price of the difrent options and get the total price and send it on the email aswell?
This is something i coded, here it adds the price but this cant be used to send the email. i need two values in one option.
U can see the price in the option value under here
<p>
Hosted Services Type:
<div class="contentcontainer med left" style="margin-left: 350px;position: relative;
bottom: 35px;">
<select id="selectedServerCount" name="Hosted Services Type" onClick="updateSelected()">
<option value="0">Velg tilgang </option>
<option value="100">1 Azure </option>
<option value="200">2 Applikasjon </option>
<option value="300">3 Online </option>
</select>
</p>
</div class>
<p>
<span id="showSelectedServerCount"></span>
</p>
<script type="text/javascript">
function updateSelected() {
var antServers = document.getElementById("selectedServerCount");
var selectedAntServers = antServers.options[antServers.selectedIndex].value;
var showSelectedServerCount = document.getElementById("showSelectedServerCount");
showSelectedServerCount.innerHTML = "Pris: " + selectedAntServers + " NOK";
}
</script>
<p>Summen blir:</p>
<button onclick="sum()">Trykk for totalsum</button>
<p id="demo2">Totalsummen: </p>
<script type="text/javascript">
function sum()
{
var fn, ln, sn, tn, result;
fn = parseInt(document.getElementById("selectedServerCount").value, 10);
ln = parseInt(document.getElementById("selectedServerCount2").value, 10);
sn = parseInt(document.getElementById("selectedServerCount3").value, 10);
tn = parseInt(document.getElementById("selectedServerCount3").value, 10);
result = (fn+ln+sn+tn);
document.getElementById("demo2").innerHTML = "Totalsummen blir: " + result + " NOK";
//result = (parseFloat(fn)+parseFloat(ln));
}
</script> |
|