I just ran into this cost estimator and it's exactly what I need for my screen printing web site. Does anyone know how to do this? Thanks!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<SCRIPT LANGUAGE="JavaScript">
/* Copyright Reaz Hoque, 1996, All right reserved. Web: [URL unfurl="true"]http://rhoque.com,[/URL] email: rhoque@rhoque.com
This code can be used for non-profit use only if the copyright notice is kept. */
// Courtesy of SimplytheBest.net - [URL unfurl="true"]http://simplythebest.net/scripts/[/URL]
var called=false;
var T_Price=0;
var Line1_flag;
var Line1_print="";
var Line2_flag;
var Line2_print;
var Line3_flag;
var Line3_print;
var percent=".9"
var P_Price=0;
var A_Price=0;
function compute(form){
called=true;
//-------gildanultracotton----------
if (form.gildanultracotton[0].selected){
Line1_print= "None";
Line1_flag=0;
}
if (form.gildanultracotton[1].selected){
Line1_flag =.99;
Line1_print="White/Neutral";
}
else if (form.gildanultracotton[2].selected){
Line1_flag =1.56;
Line1_print="Ash/Sports Grey";
}
else if (form.gildanultracotton[3].selected){
Line1_flag =1.79;
Line1_print="All Other Colors";
}
//-------Front Side Colors----------
if (form.front[0].selected){
Line2_flag=0;
Line2_print="None";
}
if (form.front[1].selected){
Line2_flag=.35;
Line2_print="1";
}
if (form.front[2].selected){
Line2_flag=.50;
Line2_print="2";
}
if (form.front[3].selected){
Line2_flag=.75;
Line2_print="3";
}
if (form.front[4].selected){
Line2_flag=.95;
Line2_print="4";
}
//-------Back Side Colors-----------
if (form.backside[0].selected){
Line3_flag=0;
Line3_print="None [$0]";
}
if (form.backside[1].selected){
Line3_flag=1.75;
Line3_print="1";
}
if (form.backside[2].selected){
Line3_flag=1.95;
Line3_print="2";
}
if (form.backside[3].selected){
Line3_flag=2.25;
Line3_print="3";
}
if (form.backside[4].selected){
Line3_flag=2.40;
Line3_print="4";
}
P_Price=Line1_flag+Line2_flag+Line3_flag;
A_Price=P_Price*percent
T_Price=P_Price+A_Price
form.T_Price.value=" $ "+ T_Price;
}
function print(form){
if(!called){
compute(form);
}
text = ("<HEAD><TITLE>'Cost Esimator'</TITLE></HEAD>");
text = (text +"<BODY BGCOLOR = '#FFFFFF' ><CENTER><B><FONT SIZE = 3><FONT COLOR=BLUE>Cost Estimator</FONT></FONT></B>");
text= (text +"<br></CENTER>");
text=(text+"<hr>");
text=(text+"<TABLE BORDER =0><TR VALIGN=Top><TD VALIGN=Top>");
text=(text+"<B>Productline1: <BR>Productline2: <BR>Productline3:");
text=(text+"</B></TD><TD>")
text=(text+"<B>"+ Line1_print+"<BR>"+ Line2_print+"<BR>"+ Line3_print+"<BR>");
text=(text+"<TD></TR></TABLE><hr>");
text=(text+"<B><FONT COLOR=RED>Total Cost:</FONT>"+" $"+T_Price);
text=(text+"<BR><BR><FONT SIZE=-1><FONT COLOR=Gray>To print, choose File and Print.</FONT></FONT>");
text=(text+"</body></html>");
msgWindow=window.open("","displayWindow","toolbar=no,width=375,height=250,directories=no,status=yes,scrollbars=yes,resize=no,menubar=yes")
msgWindow.document.write(text)
msgWindow.document.close()
}
</SCRIPT>
Here's my form:
</script>
<form method="post">
<table cellpadding="4" bgcolor="#EAE8E8">
<tr>
<td>Gildan Ultra Cotton:<br>
<select name="gildanultracotton">
<option selected>Select
<option>White/Neutral
<option>Ash/Sports Grey
<option>All Other Colors
</select></td>
<td>Front Side Colors:<br>
<select name="front">
<option selected>Select
<option>1
<option>2
<option>3
<option>4
</select></td>
<td>Back Side Colors:<br>
<select name="backside">
<option>Select
<option>1
<option>2
<option>3
<option>4
</select></td>
<tr>
<td><br>
<input type="BUTTON" name="Price" value="Update Price" onClick="compute(this.form)">
<input type="text" size="13" name="T_Price" value></td>
<td valign="top"><br>
<input type="BUTTON" name="Print_data" value="Print Preview" onClick="print(this.form)"></td>
</tr>
</table></td>
</tr>
</table>
</form>