Your cart is currently empty!
Length in inches:
Width in Inches:
The code below is supposed to show the prices for different products based on the Length and Width of a screen entered.
Length in inches:
Width in Inches:
I cannibalized some code and here’s the end result. If anyone ever needs something like this feel free to grab it and modify
<html>
<head>
<article>
<script>
var linch, winch, tinch, total, price, temp;
function screens() {
linch = parseInt(document.getElementById("one").value);
winch = parseInt(document.getElementById("two").value);
if (linch && winch) {
temp = document.getElementById("price");
temp.style.display = "block";
tinch = linch * winch;
total = tinch / 144;
price = total * 9;
document.getElementById("euroscreen").value = (Math.round(price * 100) / 100).toFixed(2);
price = total * 11;
document.getElementById("doubleeuroscreen").value = (Math.round(price * 100) / 100).toFixed(2);
price = total * 13;
document.getElementById("honycombsunshade").value = (Math.round(price * 100) / 100).toFixed(2);
price = total * 15;
document.getElementById("honycombeuroscreen").value = (Math.round(price * 100) / 100).toFixed(2);
price = total * 17;
document.getElementById("doublehonycomb").value = (Math.round(price * 100) / 100).toFixed(2);
}
}
</script>
</head>
<body>
<p id="input">Length in inches: <input id="one">
<br /><br />
Width in Inches: <input id="two">
</p>
<p><button onclick="screens()">Screen Pricing</button></p>
<p id="price" style="display:none;">
Euroscreen Price = <input id="euroscreen"><br /><br />
Double Euroscreen Price = <input id="doubleeuroscreen"><br /><br />
Honycomb Sunshade Price = <input id="honycombsunshade"><br /><br />
Honycomb+Euroscreen Combo Price = <input id="honycombeuroscreen"><br /><br />
Double Honycomb Price = <input id="doublehonycomb"><br /><br />
</article>
</body>
</html>
Leave a Reply