I've had this happen to me before. There would always be this forgeter banging on our door and running away. One day, the kid game knocking on the door again. My dad had enough of it and went outside and chased the boy down the sidewalk. He was right next to my room door. The kid stopped knocking after the incident.
Now, I will not be sarastic. When they knock, just run to the door, open it and yell at those kids unless they are teenagers. If they dont stop, as PurpleMetro said, you might want to put a sound recorder. If that does not work, try using a motion sensing light. It might scare them because a light flashes at them, and they know they have been caught. If all else fails, why not give them a taste of their own medicine and knock on their doors?