How spyware is installed in a computer without giving alert to users?

How spyware is installed in a computer without giving alert to users. As per my knowledge from programs like asp, aspdotnet or java. we cant access the client side system. But some site says with javascript a spyware can be installed. How and Why ?
6 answers 6