Software Testing Techniques Homework 1

时间:2023-03-09 09:03:49
Software Testing Techniques Homework 1

I have met some errors in recent years, one of them which impress me most. It happend when I try to finish a web project with javascript for my web final project.

In a web project, we often use 'button' to trigger some events, some times it is very simple, we just write like this, it is enough, we don't need parameters.

Software Testing Techniques Homework 1

But, if we try to use the button to select the object we have selected before, we don't want to use the selector again in the binded-function, like this.

Software Testing Techniques Homework 1

At first, I wrote the code like this,

$(obj).click(dele(obj2));

Then, there is an error, the most upset me was the Click function always autorun without any click!

I used Bind() function, used global variables as the parameter, no matter how I correct the parameter, the error always happen. It cost too much time!

Finally, I had solved the problem, because I found the reason that I shouldn't send the parameter to a callback function use a normal way!

The most important thing I learned from this error is I should figure out something totally before I used it.