HTML DOM documentURI attribute
HTML DOM documentURI Attributes
Instance
<!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>
Running Instance»
Click the "Run Instance" button to view the online instance
Definition and usage
The documentURI attribute can set or return the location of the document.
If the document was created by a DocumentImplementation object, or if it is undefined, null is returned.
Browser support
Except Internet Explorer, other browsers support the documentURI attribute.
Syntax
Set the documentURI of the document:
document.documentURI=locationURI
Return documentURI:
document.documentURI
Technical details
A string representing the URI of the document. | |
---|---|
Core Level 3 Document Object |
##