HTML DOM Bingkai / IFrame frameborder properti
Frame / benda iFrame
Definisi dan Penggunaan
set properti frameborder atau mengembalikan nilai properti frameborder frame / iframe elemen.
Atribut frameborder menentukan apakah akan menampilkan perbatasan sekitar iframe.
tatabahasa
frameObject.frameBorder=value
或者
iframeObject.frameBorder=value
或者
iframeObject.frameBorder=value
atribut frameborder dapat memiliki nilai berikut:
值 | 描述 |
---|---|
1 | 开启边框(默认) |
0 | 关闭边框 |
Dukungan Browser
Semua browser utama mendukung properti frameborder
contoh
contoh 1
Kembali Nilai atribut frameborder:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" frameborder="0">
<p>你的浏览器不支持 iframes.</p>
</iframe>
<p>这个frameborder已设置:
<script>
document.write(document.getElementById("myframe").frameBorder);
</script>
<p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" frameborder="0">
<p>你的浏览器不支持 iframes.</p>
</iframe>
<p>这个frameborder已设置:
<script>
document.write(document.getElementById("myframe").frameBorder);
</script>
<p>
</body>
</html>
Coba »
contoh 2
Hapus frameborder:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function removeBorder(){
document.getElementById("myframe").frameBorder="0";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="removeBorder()" value="移除边界">
<p><b>注意:</b> 该实例不能工作在IE浏览器。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function removeBorder(){
document.getElementById("myframe").frameBorder="0";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com">
<p>你的浏览器不支持iframes。</p>
</iframe>
<br><br>
<input type="button" onclick="removeBorder()" value="移除边界">
<p><b>注意:</b> 该实例不能工作在IE浏览器。</p>
</body>
</html>
Coba »
Frame / benda iFrame