There's several ways I can think of:
Multiple images as you said (not ideal).
Relative/absolute positioning to move the input over the image (or vice-versa) (means the image is properly IN the page for layout).
Background image on the input's container element (what Yahoo have done).
The second two would use CSS, the first not really.
Handy hint: With web pages, if you know of an example page, such as your Yahoo example, which does an effect you want, have a look at their code (as it can't be hidden) and see how they do it.