Frame/IFrame FrameBorder property
Frame/IFrame objectDefinitions 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
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
The frameBorder property is supported by all major browsers
Instance 1
Returns the value of the frameborder property:
<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:
<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 . . .
Frame/IFrame object