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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iFrame Question! Pls Help 1

Status
Not open for further replies.

Forri

Programmer
Oct 29, 2003
479
MT
Hi All

I have an iFrame and when i load a certain page i would like it to turn off or on (as necessary) the iFrames scrollbar! Is it possible?

if so how can i script it?

Thanks
Nick
 
set it off:
document.getElementById("IFRAMEID").setAttribute("scrollbars","no")

set it on:
document.getElementById("IFRAMEID").setAttribute("scrollbars","yes")


Known is handfull, Unknown is worldfull
 
nothing is happening and neither an error is given!?

Thanks for your time
Nick
 
can i have ur code? only the Iframe's, did u set the iframe's id???

Known is handfull, Unknown is worldfull
 

Hi,

Maybe you are using that code in IE6 in IE6 the setAttribute method does not work, instead you need to access the attribute directly like this:

document.getElementById("IFRAMEID").scrollbars = "yes";

the way vbkris wrote works ok in firefox and other IE versions but setAttribute was removed in the v6.
 
Hi guys

this is what i have;

Code:
window.onload = new Function ('parent.top.document.getElementById("mainFrame").scrollbars ="no"');

thanks
Nik
 
can i have the iframe code???

Known is handfull, Unknown is worldfull
 
yes sure..here u go..


Code:
<iframe ID="mainFrame" src="" width="100%" height="100%" scrolling="yes" frameborder=0 align="right" marginwidth="0" marginheight="0"></iframe>

I know that the above attribute is set to on, but some other source scripts require the scrollbar and other do not!

Thanks
Nick
 
hi,
there seems to be a strange problem here:
Code:
<html>
<iframe ID="mainFrame" src="" width="100%" height="100%" scrolling="yes" frameborder=0 align="right" 

marginwidth="0" marginheight="0"></iframe>
</html>
<script>
document.getElementById("mainFrame").setAttribute("scrolling","no")
alert(document.getElementById("mainFrame").getAttribute("scrolling"))
</script>

even though it isset to No it doesnt change, i thik its because an iframe is windowed element...

Known is handfull, Unknown is worldfull
 
Try this - the scrollbar disappears onn IE6.

for more (slightly coinfusing) info see


Code:
<html>

<body>

<span onclick="achoo();">NoScrollBar</span>




<iframe ID="mainFrame1" src="x.htm" width="100%" height="40%" scrolling="no" frameborder=0 align="right" 

marginwidth="0" marginheight="0"


style="border: 0;  overflow: hidden; scrollbar-base-color: blue; scrollbar:no;  " >

</iframe>


<script>

function achoo()  {

document.frames("mainFrame1").document.body.style.overflow="hidden";


}


</script>
 
worked great thanks!

Do you think it will work on IE 5.5?

Thanks again
Nick
 
I tried about 30 things before I found one that worked.

My partly uninformed opinion is that the IE6 Iframe is full of subtle bugs and I wish I had the time to discover/document them all... (so many subtle combinations - so many bugs - so little time)

After service packs, my version of IE5.5 in general had few bugs.

I don't have IE5.5 any more to test ... IFRAME "should" work the same.... but I dont know.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top