<table>
<tr>
<td>ENTER PRINCIPLE AMOUNT</td>
<td><input type="text" name="principle" size="7"></td>
</tr>
<tr>
<td>ENTER RATE OF INTEREST</td>
<td><input type="text" name="rate" size="7"></td>
</tr>
<tr>
<td>ENTER TIME</td>
<td>
<SELECT id ="date" name = "dd"></SELECT>
<SELECT id ="month" name = "mm"></SELECT>
<SELECT id ="year" name = "yyyy"></SELECT>
</td>
</tr>
</table>
date_populate("date", "month", "year"); //to get dropdown list containing continuos values
i .e 1,2,3,4,5,6,7,8......31 in date to select number of days.in month 1,2,3...12.and
in year 1,2,3....
//as i move the cursor over dropdown menu i need to get this values.
function simple()
{
var p,r,n,i;
if(document.interest.principle.val=="")
{
alert("pleas enter principle value");
document.interest.principle.alert();
}
else if(document.interest.rate.val=="")
{
alert("pleas enter rate value");
document.interest.rate.blur();
}
else if(document.interest.year.val=="")
{
alert("pleas enter year value");
document.interest.year.prompt();
}
else
{
p=parseInt(document.interest.principle.value);
r=parseInt(document.interest.rate.value);
n=parseInt(document.interest.year.value);
i=p*r*n/100;
document.interest.answer.value="simple interest:"+i;
}
}
i need three dropdowns to select days ,month and year.As user selects these values in dropdown simple interest should be calculated automatically in simple interest textfield. but in above code i am geting only dropdown with no values.
See Fiddle : http://jsfiddle.net/Lyffxjx7/
$("select").on("change", function () {
$("#amount").val(" " + $(this).val() + "s").show();
});
You will have to repeat this principle with multiple inputs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.