Here is the simple shopping cart I was looking for: http://code.google.com/p/jscart/wiki/Example. Thank you everyone for your help. All the notes led me to rethink and ponder ... hmm, I wonder if someone out there has already done something similar ...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It's because of your "currentStateOpened". If you addd your first Item it will be set to false and thus the second item will have as total price "0".
However, you probably should code the whole thing differently. I hope that is for training purposes to get started with JS and you don't plan on using that in real life :)