HTML DOM documentURI 属性


HTML DOM documentURI 属性

インスタンス

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>

<p id="demo">单击按钮来显示该文档的位置</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
	var x=document.getElementById("demo");
	x.innerHTML=document.documentURI;
}
</script>
<p><strong>注意:</strong>Internet Explorer不支持documentURI属性。</p>

</body>
</html>

インスタンスの実行 »

「インスタンスの実行」ボタンをクリックしてオンラインインスタンスを表示します


定義と使用法

documentURI 属性を設定するか、ドキュメントの場所を返します。

ドキュメントが DocumentImplementation オブジェクトによって作成された場合、または未定義の場合は null を返します。


ブラウザのサポート

QQ截图20161108165429.png

Internet Explorer を除き、他のブラウザは documentURI 属性をサポートします。


構文

ドキュメントの documentURI を設定します:

document.documentURI=locationURI

Return documentURI:

document.documentURI

技術的な詳細

戻り値: String はドキュメントの URI を表します。
DOMバージョンコアレベル3ドキュメントオブジェクト