Frame/IFrame FrameBorder property

HTML DOM Frame/IFrame FrameBorder property Frame/IFrame object

Definitions and usages

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

The frameborder property specifies whether the borders around iframe are displayed.

Grammar

frameObject.frameBorder= value

or

iframeObject.frameBorder= value

The frameBorder property can be the following value:

value describe
1 Turn on the border (default)
0 Close border


Browser support

HTML DOM Frame/IFrame FrameBorder property HTML DOM Frame/IFrame FrameBorder property HTML DOM Frame/IFrame FrameBorder property HTML DOM Frame/IFrame FrameBorder property HTML DOM Frame/IFrame FrameBorder property

The frameBorder property is supported by all major browsers


Instance 1

Returns the value of the frameborder property:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
</head>
<body>

<iframe id="myframe" src="http://www.w3cschool.com" rel="external nofollow" rel="external nofollow" frameborder="0">
<p>你的浏览器不支持 iframes.</p>
</iframe>

<p>这个frameborder已设置:
<script>
document.write(document.getElementById("myframe").frameBorder);
</script>
<p>

</body>
</html>

Try it out . . .

Instance 2

Remove frameborder:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
<script>
function removeBorder(){
document.getElementById("myframe").frameBorder="0";
}
</script>
</head>
<body>

<iframe id="myframe" src="http://www.w3cschool.com" rel="external nofollow" rel="external nofollow" >
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="removeBorder()" value="移除边界">
<p><b>注意:</b> 该实例不能工作在IE浏览器。</p>

</body>
</html>

Try it out . . .


HTML DOM Frame/IFrame FrameBorder property Frame/IFrame object