Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enabling or disabling frame scrolling 1

Status
Not open for further replies.

lovekang

Programmer
Feb 16, 2006
86
KR
I have to enabling or disabling for some reasons.
some pages require enabled scroll, and some pages require scroll-disabled frame.

index.html
<html xmlns="<head>
<title>HCC HSIMS</title>
</head>
<frameset cols="161,*" rows="*" frameborder="no" border="0" framespacing="0">
<frame src="left.html" name="leftFrm" scrolling="No" noresize="noresize" id="leftFrm" title="leftFrm" />
<frameset rows="80,*" frameborder="no" border="0" framespacing="0">
<frame src="top.html" name="topFrm" scrolling="No" noresize="noresize" id="topFrm" title="topFrm"/>
<frame src="main.html" name="mainFrm" id="mainFrm" title="mainFrm" scrolling="No"/>
</frameset>
</frameset>
<noframes><body>
</body>
</noframes></html>

top.html
<html xmlns="<head>
<title>Untitled Document</title>
</head>
<body>
top.html
</body>
</html>


left.html
<html xmlns="<head>
<title>Untitled Document</title>
</head>
<body>
left.html
</body>
</html>


main.html
<html xmlns="<head>
<title>Untitled Document</title>
</head>
<script>
function enableScroll(){
parent.document.getElementById("mainFrm").scrolling = 'yes';
}
</script>
<body onload="enableScroll();">
main.html
</body>
</html>
 
the index.html page has 3 pages
| |------------------
|left.| top.html
| html|------------------
| |
| | main.html
| |

if main.html looks like the below the scrolling should be disabled,
<html xmlns="<head>
<title>Untitled Document</title>
</head>
<script>
function disableScroll(){
parent.document.getElementById("mainFrm").scrolling = 'no';
}
</script>
<body onload="disableScroll();">
main.html
</body>
</html>

if main2.html looks like the below, the main2.html page have to scrolling bar.

<html xmlns="<head>
<title>Untitled Document</title>
</head>
<script>
function enableScroll(){
parent.document.getElementById("mainFrm").scrolling = 'yes';
}
</script>
<body onload="enableScroll();">
main.html
</body>
</html>
 
yes. IE doesn't tell me there are errors in it.
but no scrollbar there.

Just resize the browser and check it out if there is a scroll bar.
 
[1] In ie, since you are changing that in mainFrm from the page loaded in the same window, you can do this.
[tt]window.document.body.scroll="yes";[/tt]
If you want the line applicable to any other frames as well as to itself mainFrm alike, then it is this.
[tt]top.frames["frmMain"].document.body.scroll="yes";[/tt]
[2] In moz, be prepared to be flamed (though in this circumstances I fail to follow the argument.) The short answer is no, not that I know of till this moment. (You know, web wisdom may change upon time, and the argument often can go both ways.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top