0
我正在嘗試使用變量從對象中收集信息。我是一名PHP程序員,即時通訊還不是很好。Javascript對象使用變量獲取對象
var priceobj= {'Youth Small':'0', 'Youth Meduim':'0', 'Youth Large':'0','Adult Small':'0','Adult Medium':'0','Adult Large':'0','Adult XL':'0','Adult XXL':'2','Adult XXXL':'3'};
var os0 = $('#os0').val(); // value will be one of the options in priceobj
var value = priceobj.os0 // this should read 0,2,3 depending on the value of os0