我从选择框 1) 高度和 2) 宽度更改函数中得到两个值,我必须乘以高度 + 宽度 * 2 = 价格,在此计算之后我必须提醒价格。
var height =0 ;
var width =0 ;
var price=0;
$("#Heightproduct").change(function() {
h = $(this).val();
var height = parseInt(h);
price = height + width * 2;
alert(price);
});
$("#Widthproduct").change(function() {
w = $(this).val();
var width = parseInt(w);
price = height + width * 2;
alert(price);
});
这是没有输出的屏幕截图。这里我选择了 height=25 width=25 并且我在警报 50 中得到输出,这是错误的,我想要的答案应该是 100