Here is jquery code for calculation .This works in Firefox but doesn't work in IE8.I'm using Asp.net mvc.
var multiplier;
var multiplicand;
multiplier = $("#ddlExchangeRate_" + exRateId).val();
if (multiplier != "") {
if (exRateId == 1) {
multiplicand = $("#grossTotal_" + exRateId).val();
}
if (exRateId == 2) {
multiplicand = $("#discount_" + exRateId).val();
}
if (exRateId == 3) {
multiplicand = $("#totaltaxRate_" + exRateId).val();
}
MultiplyByExchangeRate(multiplicand, multiplier, exRateId);
calculateGrandTotalNrs();
//For Nrs rates calculations
}
return;
});
$(".ddlExchangeRate").live("change", function() {
var self = $(this);
var id = self.attr("id");
var index = id.search("_");
var exRateId = id.substring(index + 1);
var multiplicand;
var multiplier = $("#ddlExchangeRate_" + exRateId).val();
if (exRateId == 1) {
multiplicand = $("#grossTotal_" + exRateId).val();
MultiplyByExchangeRate(multiplicand, multiplier, exRateId);
}
if (exRateId == 2) {
multiplicand = $("#discount_" + exRateId).val();
MultiplyByExchangeRate(multiplicand, multiplier, exRateId);
}
if (exRateId == 3) {
multiplicand = $("#totaltaxRate_" + exRateId).val();
MultiplyByExchangeRate(multiplicand, multiplier, exRateId);
}
calculateGrandTotalNrs();
});
});
here is code for drop downlist.When dropdown list is selected,the value in upper three textbox is calculated according to selected dropdown list value and display on lower three text box.
This is the three dropdown list.
<td><% = Html.DropDownList("ddlExRates0", (SelectList)ViewData["ddlExRates"], "Select", new { @class = "ddlExchangeRate", id = "ddlExchangeRate_" + 1 })%>
<td><% = Html.DropDownList("ddlExRates1", (SelectList)ViewData["ddlExRates"], "Select", new { @class = "ddlExchangeRate", id = "ddlExchangeRate_" + 2 })%>
<% = Html.DropDownList("ddlExRates2", (SelectList)ViewData["ddlExRates"], "Select", new { @class = "ddlExchangeRate", id = "ddlExchangeRate_" + 3 })%>
This is the three upper text box.
<td>$<% = Html.TextBox("grossTotal","", new { id = "grossTotal_" + 1, @class = "xoRates",@readonly = true })%>
<td>$<% = Html.TextBox("tax", "", new { id = "totaltaxRate_" + 3, @readonly = "true", @class = "xoRates" })%>
<td>%<% = Html.TextBox("discount", "", new { id = "discount_" + 2, @class = "xoRates" })%>
<td>Nrs<% = Html.TextBox("grossTotalNrs","",new {@readonly = true})%>
this is te lower three text box where calculated value is displayed.
<td>Nrs<% = Html.TextBox("discountNrs","",new{@readonly = true})%>
<td>Nrs<% = Html.TextBox("taxNrs","",new{ @readonly = true})%>
<td>Nrs<% = Html.TextBox("totalNrs","",new{ @readonly = true})%>