3 つの入力を連続して更新します。これらはボタンを 1 回クリックするだけで順次更新され、更新の完了後に各入力にクールな色の変化 (光る) 効果を適用します。
t = 時間の場合、次のように表示されるはずです (科学者になったような気分です)。
[30.20] [20.32] [34.33] [Update] <--- Clicked this
t=1 Glow
t=2 Glows
t=3 Glows
ただし、色の効果が次のように順不同になることがあります。
[30.20] [20.32] [34.33] [Update] <--- Clicked this
t=1 Glow
t=2 Glows
t=3 Glows
これが私のスクリプトです:
参考:テストしたところ、シーケンスの問題が.each
ページ上では、それらは次々に表示されます。
function UpdatePrice(TheButton, Type) {
$(TheButton).parent().parent().find("input").each(function (index, element) {
$.ajax({
cache: false,
data: { ByContractID: $(element).parent().attr("id"), Cost: $(element).val(), ItemType: Type },
type: "Post",
url: '@Url.Action("UpdateCost")'
}).success(function () {
$(element).next().html(($(TheButton).parent().parent().children("td").eq(0).html() * $(element).val()).toFixed(2));
$(element).val(parseFloat($(element).val()).toFixed(2));
var old = $(element).css('background-color');
$(element).animate({ "background-color": "#D2F0C9" }, "fast", function () { $(element).animate({ "background-color": old }, "fast") });
});
});
return false;
}
皆さんはどう思いますか?
ありがとう!