要取得某個區域的 href 屬性的查詢字串,請使用 search 屬性。您可以嘗試執行以下程式碼來搜尋查詢字串 -
<!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").search; document.write("<br>Querystring: "+x); </script> </body> </html>
以上是如何在JavaScript中搜尋area標籤的href屬性中的查詢字串部分?的詳細內容。更多資訊請關注PHP中文網其他相關文章!