HTML DOM Base 對象

Base 對象

Base 對象代表 HTML <base> 元素。

訪問 Base 對象

您可以使用 getElementById() 訪問 <base> 元素:

var x = document.getElementById("myBase");

親自試一試

創建 Base 對象

您可以使用 document.createElement() 方法創建 <base> 元素:

var x = document.createElement("BASE");

親自試一試

Base 對象屬性

屬性 描述
href 設置或返回 base 元素中 href 屬性的值。
target 設置或返回 base 元素中 target 屬性的值。

標準屬性和事件

Base 對象同時支持標準屬性事件

相關頁面

HTML 參考手冊:HTML <base> 標簽