the problem I am having is in getting my page to produce an expected delivery date. The calculation function is working fine. I want to use the same id to figure out when the product will be delivered. I know my second set of if statements is wrong but I cant figure out how to take my current date and add days to it and have it output the delivery date. This is not a homework assignment. It is a practice for our final and I know the instructor is going to include it. Any help will be appreciated.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>New Page 1</TITLE>
<META http-equiv=Content-Language content=en-us>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<script>
//function getTax()
//{
//alert("get tax function");
//}
function calculatePrice()
{
//alert("inside calculate price");
var inPrice = parseFloat( document.getElementById("price").value);
//alert(inPrice);
var inQuantity = (document.getElementById("quantity").value);
//alert(inQuantity);
var shipping = parseFloat( document.getElementById("shipping").value);
var inTax = parseFloat( document.getElementById("state").value);
//alert(inTax);
var state;
var totalPrice;
//alert(document.getElementById("state").selectedIndex);
if(document.getElementById("state").selectedIndex==0)
{
state = 0.06;
//document.getElementById("state").option[0].value;
// alert("Iowa 0.06");
}
if(document.getElementById("state").selectedIndex==1)
{
state = 0.085;
//alert("Illinois 0.085");
}
if(document.getElementById("state").selectedIndex==2)
{
state = 0.7;
//alert("Indiana 0.7");
}
if(document.getElementById("state").selectedIndex==3)
{
state = 0;
//alert("Other");
}
var shipping = parseFloat( document.getElementById("shipping").value);
//alert(shipping);
if(document.getElementById("shipping").selectedIndex==0)
{
shipping = 0.02;
//alert("standard ups 0.02");
}
if(document.getElementById("shipping").selectedIndex==1)
{
shipping = 0.01;
//alert("US Mail 0.01");
}
if(document.getElementById("shipping").selectedIndex==2)
{
shipping = 0.05;
//alert("Overnight 0.05");
}
if(document.getElementById("shipping").selectedIndex==3)
{
shipping = 0;
//alert("Pick up no charge");
}
inTax = inPrice * state ;
//alert(inTax);
totalPrice = inTax + (inPrice * shipping) + inPrice ;
document.getElementById("total").value = totalPrice;
//alert("intax" + inTax + "qty" + inQuantity + "del" + shipping)
var now = new date()
var expectedDate
if(document.getElementById("shipping").selectedIndex==0)
{
now + 3;
//document.getElementById("state").option[0].value;
alert("option 1");
}
if(document.getElementById("shipping").selectedIndex==1)
{
now + 5;
alert("option 2");
}
if(document.getElementById("shipping").selectedIndex==2)
{
now + 1;
alert("option 3");
}
if(document.getElementById("shipping").selectedIndex==3)
{
now;
alert("get it yourself");
}
document.getElementById("delivery").value = ExpectedDate;
}
</script>
</HEAD>
<BODY text=#330000 bgColor=#00ccff ;>
<H1 align=center>Calculate Your Order</H1>
<FORM name=frmProd method=GET>
<P>Price: <input type="text" name="price" value="" id="price" /></P>
<P>Quantity: <SELECT size=1 type="text" name="quantity" id="quantity" /> <OPTION value=1 selected>1</OPTION>
<OPTION value=2>2</OPTION> <OPTION value=3>3</OPTION> </SELECT></P>
<P>State: <SELECT size=1 type = "text" name="state" id = "state" onChange ="getTax()"/>
<OPTION selected value=0.06>Iowa</OPTION>
<OPTION value=0.085 >Illinois</OPTION>
<OPTION value=0.7>Indiana</OPTION>
<OPTION value=0>Other</OPTION> </SELECT></P>
<P>Delivery <SELECT size=1 name=shipping id="shipping">
<OPTION value=0.02 selected>Standard UPS - 3 Days</OPTION>
<OPTION value=0.01>US Mail - 5 Days</OPTION>
<OPTION value=0.05>Overnight - 1 Day</OPTION>
<OPTION value=0>Pickup</OPTION>
</SELECT><BR>Method:</P>
<P>Your Total is: <INPUT value=0.00 name="total" id = "total" /></P>
<P>Expected Delivery Date:
<input type="text" name="delivery" id="delivery">
</P>
<P><INPUT type="button" name = "button" id = "button" value="Calculate My Order Now!" onclick = "calculatePrice()" name=btnSubmit></P></FORM></BODY></HTML>