Can I have eye surgery during the three weeks if I avoid the 9 days?
If there is a need for it to be done then, then it is permitted. Otherwise it should preferrably be scheduled for after the three weeks. The reason being that we try not doing things that can involve sakana (danger) during this period.
Emes L’yackov Siman 551 ftnt 515, Kovetz Halachos (Bein Hamitzarim) 7-4.