HTML DOM Frame/IFrame frameBorder 屬性

2023-04-14 11:29 更新
Frame/IFrame 對(duì)象參考手冊(cè)Frame/IFrame 對(duì)象

定義和用法

frameBorder 屬性可設(shè)置或者返回 frame/iframe 元素的 frameborder 屬性值。

frameborder 屬性指定是否顯示 iframe 周圍的邊框。

語法

frameObject.frameBorder=value

或者

iframeObject.frameBorder=value

frameBorder 屬性可以是以下值:

描述
1 開啟邊框(默認(rèn))
0 關(guān)閉邊框


瀏覽器支持

Internet Explorer Firefox Opera Google Chrome Safari

所有主要瀏覽器都支持 frameBorder 屬性


實(shí)例

實(shí)例 1

返回 frameborder 屬性的值:

<!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>這個(gè)frameborder已設(shè)置:
<script>
document.write(document.getElementById("myframe").frameBorder);
</script>
<p>

</body>
</html>

嘗試一下 ?

實(shí)例 2

移除 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> 該實(shí)例不能工作在IE瀏覽器。</p>

</body>
</html>

嘗試一下 ?


Frame/IFrame 對(duì)象參考手冊(cè)Frame/IFrame 對(duì)象


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)