How insert a method Javascript, tutorial?

Hi, Where I can see a tutorial for to insert a javascript for validate a field?