function check(){
var d = new Date();
var date = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
var state = document.form1.state.value;
if(state==1){
document.getElementById("expDate").innerHTML = (date + 4) + "/" + month + "/" + year;
}
else if(state==2){
document.getElementById("expDate").innerHTML = (date + 7) + "/" + month + "/" + year;
}
}
<form name="form1" >
<table width="20%">
<tr>
<td>Select State: </td>
<td>
<select name="state">
<option value=1>CANSAS</option>
<option value=2>NEW YORK</option>
</select>
</td>
</tr>
<tr>
<td>Expected Delivered:</td>
<td><p id="expDate"></p>
</td>
</tr>
<td>
</td>
<td>
<input type="submit" name="submit" value="submit" onClick="return check()">
</td>
</tr>
</table>
</form>
I'm creating a postage calculator using HTML and JavaScript. The calculator will calculate the expected delivery date when users select the state option and submit. After the submit, the selected value will be caught by JavaScript and used as to recognize which area of the state is (south, west, else). Eg: cansas, which is west, duration will be 5 days. Then in the same page the expected delivery date will be shown after it calculate by adding the 5 with current date.