JavaScript リファレンスマニュアル
/ HTML DOM documentURI 屬性
HTML DOM documentURI 屬性
HTML DOM documentURI 屬性
實(shí)例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <p id="demo">單擊按鈕來顯示該文檔的位置</p> <button onclick="myFunction()">點(diǎn)我</button> <script> function myFunction(){ var x=document.getElementById("demo"); x.innerHTML=document.documentURI; } </script> <p><strong>注意:</strong>Internet Explorer不支持documentURI屬性。</p> </body> </html>
運(yùn)行實(shí)例 ?
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例
定義和用法
documentURI 屬性可設(shè)置或返回文檔的位置。
如果文檔由 DocumentImplementation 對象創(chuàng)建, 或者如果它未定義,則返回 null。
瀏覽器支持
除了 Internet Explorer 瀏覽器,其他瀏覽器都支持 documentURI 屬性。
語法
設(shè)置文檔的 documentURI:
document.documentURI=locationURI
返回 documentURI:
document.documentURI
技術(shù)細(xì)節(jié)
返回值: | 字符串, 代表文檔的URI。 |
---|---|
DOM 版本 | Core Level 3 Document Object |