<!DOCTYPE html> <html> <head> <script> function showDetails(animal) { var animalType = animal.getAttribute("data-animal-type"); alert(animal.innerHTML + "是一种" + animalType + "。"); } </script> </head> <body> <h1>物种</h1> <p>点击某个物种来查看其类别:</p> <ul> <li οnclick="showDetails(this)" id="owl" data-animal-type="鸟类">喜鹊</li> <li οnclick="showDetails(this)" id="salmon" data-animal-type="鱼类">金枪鱼</li> <li οnclick="showDetails(this)" id="tarantula" data-animal-type="蜘蛛">蝇虎</li> </ul> </body> </html>