One moment they were happily munching on their dinner and watching their favorite cartoon show on television. The next moment, hundreds of children across the country were shaking and convulsing and being rushed to hospitals.

In a bizarre illustration of the medical effects that television can have on viewers, more than 700 people were taken to hospitals after having been affected by flashing lights on an animated television show broadcast Tuesday night.

Some children vomited blood and others had seizures or lost consciousness. No one died, though, and no one is expected to. Producers of the cartoon, which is highly popular among kindergarten and primary school children, say that they were stumped over how an animation technique that has been used ''hundreds of times'' could cause such a widespread, violent reaction.

''This may be the first case of mass suffering from photo stimulation,'' Toshio Yamauchi, a professor at Saitama Medical School and chairman of an organization called Electronic Screen Game and Seizures. ''We would like to study this thoroughly,'' he said.