返回到:DOM 对象:HTML DOM Document 对象
定义和用法
baseURI 属性返回 HTML 文档的基础URI。
浏览器支持
除了 IE 浏览器,其他主流浏览器都支持 baseURI 属性。
语法
node.baseURI技术细节
| 返回值: | 字符串, 代表节点页面的URI |
|---|---|
| DOM 版本 | Core Level 3 Node Object |
实例
获取文档的基础URI:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程网(web176.com)</title>
</head>
<body>
<p id="demo">单击按钮显示基础URL</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var x=document.getElementById("demo");
x.innerHTML=document.baseURI;
}
</script>
<p><strong>注意:</strong> Internet Explorer不支持基础URI属性。</p>
</body>
</html>作者:terry,如若转载,请注明出处:https://www.web176.com/javascriptbook/domtips/4576.html
支付宝
微信