Alright, I been doing a code for caculating Electricty cost. The problem I am having is are they any way of adding a box to type in. I want the users to be able to type in the info and get the correct answers. Not to have to keep going in my script!
Script is right here…
[code=php]<html>
<head>
<title> COOLOLOLOL</title>
<script type=”text/javascript”>
var wattage=2500;
var hourdaily=2;
var days=31;
var cost=0.07;
var item=(“Dishwasher”);
//DONT DO ANYTHING ELSE…………………………………………………………………….
var timeperday=(hourdaily*days);
var watts=1000
var kilowatt=(wattage/watts);
var ans=(kilowatt*timeperday);
var ans2=(ans*cost);
//title
document.write(“CACULATING HOW MUCH ELECTRICTY” + “<br />”);
document.write(“<br />”);
//given
document.write(“GIVEN” + “<br/>”);
document.write(“<br/>”);
//wattage given
document.write(” – Wattage- ” + wattage + ” W” + “<br />”);
document.write(“<br/>”);
//time per day given
document.write(” – Time Per Day- ” + hourdaily + ” hours per day” + “<br />”);
document.write(“<br/>”);
//cost given
document.write(” – Cost- ” + ” $” + cost + ” Per hour” +”<br />”);
document.write(“<br/>”);
//days given
document.write(” – Days- ” + days + “<br/>”);
document.write(“<br/>”);
//formula to caculate kilowatts
document.write(wattage + ” watts / 1000 = ” + kilowatt + ” Kw” );
document.write(“<br/>”);
document.write(“<br/>”);
//formula to caculate Total Hours
document.write(hourdaily + ” Hrs x ” + days + ” days ” + ” = ” + timeperday + ” Total hours”);
document.write(“<br/>”);
document.write(“<br/>”);
document.write(“<br/>”);
//Title to sloving!
document.write(“SLOVING”);
document.write(“<br/>”);
document.write(“<br/>”);
//Formula to caculate Total cost for a (watt) (item)
document.write(“Cost of Electricy= Kilowatt x Total hours x cost IN THAT ORDER”);
document.write(“<br/>”);
document.write(“<br/>”);
//Formula to caculate Total cost for a (watt) (item)
document.write(“= ” + kilowatt + ” Kw ” + ” x ” + timeperday + ” Total Hrs ” + ” x ” +” $ ” + cost);
//Caculating Kw.h x cost
document.write(“<br/>”);
document.write(“<br/>”);
document.write(“= ” + ans + ” Kw.H” + ” x ” + ” $ ” + cost);
document.write(“<br/>”);
document.write(“<br/>”);
document.write(“<br/>”);
//Answering the question
document.write(“ANSWERING”);
document.write(“<br/>”);
document.write(“<br/>”);
document.write(“The total cost for a ” + wattage + ” W ” + item + ” is ” + “$” + Math.round(ans2) + “.00” + “<br />”);
document.write(“<br/>”);
document.write(“<br/>”);
</script>
</head>
<body bgcolor=”yellow”>
</body>
<html>