Frame/IFrame scrollingProperty

Frame/IFrame 对象参考手册Frame/IFrame Object

Definition and Usage

The scrolling property sets or returns the value of the scrolling attribute in a frame/iframe element.

The scrolling property specifies whether scrollbars are displayed in a frame/iframe.

frameObject.scrolling=value

Or

iframeObject.scrolling=value

The scrolling property can have the following values:

Value Description
auto Automatically display scrollbars based on the document size (default).
yes Scrollbars are always displayed
no Scrollbars are never displayed


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the scrolling property


Example

Example

Return and set the value of the scrolling property:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example (example.com)</title>
<script>
function removeScroll(){
    document.getElementById("myframe").scrolling="no";
}
</script>
</head>
<body>

<iframe id="myframe" src="../index.html" scrolling="auto">
<p>Your browser does not support iframes.</p>
</iframe>
<p>The value of the scrolling attribute is:
<script>
document.write(document.getElementById("myframe").scrolling);
</script>
<p>
<input type="button" onclick="removeScroll()" value="Remove scrollbar">
<p>IE, Google Chrome, Opera, and Safari may have problems when setting the scrollbar.</p>

</body>
</html>

Try it Yourself »


Frame/IFrame 对象参考手册Frame/IFrame Object Other Extensions