HTML-DOM Gebiet Pfadname Eigenschaft
Definition und Verwendung
Pfadname Eigenschaftssätze oder gibt die href Attributwert Pfadname Komponenten.
Grammatik
areaObject.pathname=path
Browser-Unterstützung
Alle gängigen Browser unterstützen Pfadname Immobilien
Tipps und Hinweise
Hinweis: Im folgenden Beispiel, IE und Opera gibt "jsref / venus.htm", aber Firefox, Chrome und Safari return "/jsref/venus.htm".
Beispiele
Beispiele
Das folgende Beispiel gibt "Venus" im href-Attribut-Wert-Zone Pfadname:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img src="planets.gif"width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>金星区域的路径:
<script>
document.write(document.getElementById('venus').pathname);
</script>
</p>
<p><b>注意:</b> IE和Opera浏览器返回 "jsref/venus.htm",
而Firefox, Chrome, 和 Safari浏览器返回 "/jsref/venus.htm".</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<img src="planets.gif"width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>金星区域的路径:
<script>
document.write(document.getElementById('venus').pathname);
</script>
</p>
<p><b>注意:</b> IE和Opera浏览器返回 "jsref/venus.htm",
而Firefox, Chrome, 和 Safari浏览器返回 "/jsref/venus.htm".</p>
</body>
</html>
Beispiele für die obigen Ausgangs:
金星区域的路径: /try/demo_source/venus.htm
Versuchen »
Die Umgebung Objekte