A method for treating viral infection includes administering to a subject in need thereof a composition containing P2X receptor antagonists. The methods may achieve preventive or therapeutic effect on hand foot and mouth disease by inhibiting viruses. The P2X receptor antagonists can inhibit infection by a positive-sense single-stranded RNA picornavirus. The virus may be an enterovirus or a Coxsackie virus, such as human enterovirus 71. The P2X receptor antagonist may be PPADS, iso-PPADS, PPNDS, Suramin, NF023, TNP-ATP, NF279, NF157, Evans Blue, an analog thereof, a derivative thereof, or a pharmaceutically acceptable salt thereof.