HTML DOM Frame / IFrame scrolling property
Definition and Usage
scrolling property sets or returns the frame / iframe element scrolling property.
scrolling attribute specifies the frame / iframe scrollbar is displayed.
frameObject.scrolling=value
或者
iframeObject.scrolling=value
或者
iframeObject.scrolling=value
scrolling attribute can have the following values:
值 | 描述 |
---|---|
auto | 根据文档的尺寸自动显示滚动条(默认)。 |
yes | 滚动条一直显示 |
no | 滚动条永远不显示 |
Browser Support
All major browsers support scrolling property
Examples
Examples
Returns the value of the property and set scrolling:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function removeScroll(){
document.getElementById("myframe").scrolling="no";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" scrolling="auto">
<p>你的浏览器不支持iframes。</p>
</iframe>
<p>scrolling属性的值为:
<script>
document.write(document.getElementById("myframe").scrolling);
</script>
<p>
<input type="button" onclick="removeScroll()" value="移除滚动条">
<p>IE,Google Chrome,Opera,和Safari 在设置滚动条时会出现问题。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function removeScroll(){
document.getElementById("myframe").scrolling="no";
}
</script>
</head>
<body>
<iframe id="myframe" src="http://www.w3big.com" scrolling="auto">
<p>你的浏览器不支持iframes。</p>
</iframe>
<p>scrolling属性的值为:
<script>
document.write(document.getElementById("myframe").scrolling);
</script>
<p>
<input type="button" onclick="removeScroll()" value="移除滚动条">
<p>IE,Google Chrome,Opera,和Safari 在设置滚动条时会出现问题。</p>
</body>
</html>
try it"
Frame / IFrame objects