The floating eye has a passive gaze attack which causes paralysis. Every time you attack a floating eye with a melee attack, there is a 2/3 chance that it will use its gaze attack against you if your attack did not kill it. If the floating eye has been cancelled, is blind, or if you cannot see the floating eye, it cannot use its gaze attack. If you have reflection or free action, the paralysis will not affect you. 
The length of paralysis depends on your wisdom and LEV (the floating eye's level, typically 2 or 3). You are paralysed for (LEV + 1)d70 turns if your wisdom is greater than 12. Otherwise, there is a 75% chance of the same length of paralysis and a 25% chance of being paralysed for exactly 127 turns.
Upon getting the intrinsic power, "You feel a strange mental acuity" (or "You feel in touch with the cosmos" if hallucinating).
If you are affected by the floating eye's gaze, you will be paralyzed for many turns, during which you are likely to be killed by even the weakest monsters such as newts or grid bugs. Because of this, floating eyes are the cause of many YASDs. Nonetheless, if you avoid hitting them in melee they are entirely harmless, although they are not peaceful.
To kill a floating eye, it is best to use ranged weapons, polearms, or spells. If you do not have a powerful ranged attack, throw junk weapons or rocks. If you are in a room with the floating eye (rather than a corridor) and no other monsters are around, you can keep throwing your melee weapon at it and waiting for it to move so that you can retrieve your weapon. Finally, if wasting turns is not an issue, you can place yourself between the floating eye and an obstacle of some sort (locked door, boulder, a passive creature, et cetera) so the paralysis will cause no lasting damage other than wasting turns.
Floating eyes cannot harm you if you are blind. Thus you may kill them in melee if you just first blind yourself, for example by wearing a blindfold or towel. Blinding the floating eye is also effective, but there is a 1/500 chance of a -1 Luck penalty for hitting a blind floating eye. Another option is to zap it with a Wand of make invisible or otherwise make it invisible, as long as you cannot see invisible.
You can apply a mirror to paralyse a floating eye, but this is not particularly useful as it will still be able to paralyse you. (They say that a mirror will freeze a floating eye but you can still see it, from rumors.tru.)
Floating eyes, not surprisingly, are large, floating eyeballs
which drift about the dungeon. Though not dangerous in and
of themselves, their power to paralyse those who gaze at
their large eye in combat is widely feared. Many are the
tales of those who struck a floating eye, were paralysed by
its mystic powers, and then nibbled to death by some other
creature that lurked around nearby.