要在JavaScript中搜尋影像映射區域的替代文字(alt),請使用 alt 屬性。您可以嘗試執行以下程式碼以取得替代文字。
<!DOCTYPE html> <html> <body> <img src = "/images/html.gif" alt = "HTML Map" border = "0" usemap = "#html"/> <map name = "html"> <area id = "myarea" shape = "circle" coords = "154,150,59" href = "about.htm?id=company" alt = "Team" target = "_self" > </map> <script> var x = document.getElementById("myarea").alt; document.write("<br>Alternate Text: "+x); </script> </body> </html>#
以上是如何在JavaScript中搜尋圖像映射區域的替代文字?的詳細內容。更多資訊請關注PHP中文網其他相關文章!