Frame/IFrame frameBorderProperty

Frame/IFrame 对象参考手册Frame/IFrame Object

Definition and Usage

The frameBorder property sets or returns the value of the frameborder attribute of the frame/iframe element.

The frameborder attribute specifies whether to display the border around the iframe.

Syntax

frameObject.frameBorder=value

Or

iframeObject.frameBorder=value

The frameBorder property can be the following values:

Value Description
1 Border enabled (default)
0 Border disabled


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the frameBorder property


Examples

Example 1

Return the value of the frameborder attribute:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
</head>
<body>

<iframe id="myframe" src="../index.html" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>

<p>This frameborder is set:
<script>
document.write(document.getElementById("myframe").frameBorder);
</script>
<p>

</body>
</html>

Try it Yourself »

Example 2

Remove frameborder:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function removeBorder(){
    document.getElementById("myframe").frameBorder="0";
}
</script>
</head>
<body>

<iframe id="myframe" src="../index.html">
<p>Your browser does not support iframes.</p>
</iframe>
<br><br>
<input type="button" onclick="removeBorder()" value="Remove border">
<p><b>Note:</b> This example does not work in IE browsers.</p>

</body>
</html>

Try it Yourself »


Frame/IFrame 对象参考手册Frame/IFrame Object Other Extensions