You know, as humorous as I find the idea of things like this...
...I'm pretty sure they're a bad idea. (Watch the ending of this one.)
The problem with scaring people as a form of humor is that you never know for certain how they'll react. Sure, maybe they'll just jump and squeal. Or maybe they'll respond with violence. Or maybe you'll traumatize them waaaaaaaaay more than you expected. Or maybe they'll panic and do something ill-considered, and get themselves (or a bystander) badly hurt.
Scared people are unpredictable. Perhaps more importantly, scaring someone badly quickly crosses the line from funny to cruel. (And guess what? Saying, "But it was just a joke!" does not absolve you of that cruelty. Or for responsibility for anything that happens if things go seriously wrong. You don't get to say, "Well, if they hadn't panicked and done something stupid, they wouldn't have gotten hurt." Nobody thinks clearly when they're surprised. If you've set up a situation designed to get people to react before they have a chance to think, then anything they do because of it is fundamentally your fault.)
As a rule, I'd say that it's best not to really scare people unless they've agreed to it in some fashion. It's also a good idea to have someone around to intervene if things start to go wrong. But if there's any chance that your attempt at being funny is going to be mean instead, don't do it.