What is wrong with this Javascript? shopping cart

后端 未结 3 1097
自闭症患者
自闭症患者 2021-01-29 13:47

There is something in this javascript or html which is is allowing the checkboxes to be ticked but for not even half a second. (I need the checks to stay there!) I also need the

3条回答
  •  一个人的身影
    2021-01-29 14:20

    You are using i = 0 rather than var i = 0, which will introduce a global variable. This could be a problem if you're writing similar code elsewhere.

    Your if-statements are not statements at all. They look like pseudo-code. You're also comparing with = rather than ==, which will cause an assignment rather than a condition, even if you fix up your syntax.

    You are not properly indenting your code, which will make you much more prone to introduce new errors.

    These are the general issues I notice immediately. Of course, heaps of things could be wrong with this code. fields might not be an array, computer and selected might not match the size of fields, etc.

    If you have any specific problem, please describe that, and we may be able to address it.

提交回复
热议问题