HTML DOM Base target property
Definition and Usage
The target property sets or returns the base element target attribute value.
target attribute specifies the page to open all the links where they are.
grammar
baseObject.target=value
target attribute can be one of the following values:
值 | 描述 |
---|---|
_blank | 在新窗口打开链接 |
_self | 在同一个框架(默认)中打开链接。 |
_parent | 在父框架中打开链接 |
_top | 在窗口文档中打开链接。 |
framename | 在一个指定的框架中打开链接 |
Browser Support
All major browsers support target attribute
Examples
Examples
Back page target attribute all the links on the basis of the link:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<base id="htmldom" target="_blank" href="http://www.w3big.com/jsref/">
</head>
<body>
<p>所有链接的基链接:
<script>
document.write(document.getElementById("htmldom").target);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<base id="htmldom" target="_blank" href="http://www.w3big.com/jsref/">
</head>
<body>
<p>所有链接的基链接:
<script>
document.write(document.getElementById("htmldom").target);
</script>
</p>
</body>
</html>
Examples of the above output:
所有链接的基链接: _blank
try it"
Base Object