473,545 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

no scrollbars in div (firefox)

Hi,

following code does not render scrollbars in firefox 1.5.x. Bug?
Workaround other than to innerHTML an absolute positioned element
after loading?
<html>
<body>
<div style='width:10 0px;height:100p x;position:abso lute;border:1px
solid black;overflow: auto'>
<div id='test' style="position :absolute;top:0 px;left:30px">X </div>
</div>
<script>
onload = function(){
document.getEle mentById('test' ).style.left = "115px"
}
</script>
</body>
</html>

May 16 '07 #1
5 6893
*bump*
still looking for a nifty solution..

On May 16, 2:08 pm, juergen.rie...@ gmail.com wrote:
Hi,

following code does not render scrollbars in firefox 1.5.x. Bug?
Workaround other than to innerHTML an absolute positioned element
after loading?

<html>
<body>
<div style='width:10 0px;height:100p x;position:abso lute;border:1px
solid black;overflow: auto'>
<div id='test' style="position :absolute;top:0 px;left:30px">X </div>
</div>
<script>
onload = function(){
document.getEle mentById('test' ).style.left = "115px"}

</script>
</body>
</html>

May 23 '07 #2
On May 16, 2:08 pm, juergen wrote:
following code does not render scrollbars in firefox 1.5.x. Bug?
Workaround other than to innerHTML an absolute positioned element
after loading?
<ju************ @gmail.comwrote :: *bump*
: still looking for a nifty solution..

You might want to identify things like your DOCTYPE, and the type
of script you're trying to run, then not use function as a function name
(I believe it's a reserved word (?))... Anyways, the following works
in Opera, and may work in some Mozilla browsers.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>Testin g JavaScript</title>
</head>
<body>
<div style='width:10 0px;height:100p x;position:abso lute;border:1px solid black;overflow: auto'>
<div id='test' style="position :absolute;top:0 px;left:30px;"> X</div>
</div>
<script type="text/javascript">
onload = callMe();
function callMe() { document.getEle mentById('test' ).style.left = "115px"; }
</script>
</body></html>

I'm not sure scrollbars are a part of the <divobject models in
js. Perhaps someone else can help.

http://www.w3schools.com/js/js_obj_htmldom.asp

Scroll down to scrollbars and take a look at the browsers
that support scrollbars for Window objects...
http://www.w3schools.com/htmldom/dom_obj_window.asp

--
Jim Carlock
Post replies to the group.
May 23 '07 #3
dd
On May 23, 6:38 pm, "Jim Carlock" <anonym...@127. 0.0.1wrote:
then not use function as a function name
He wasn't. He was using an anonymous function.
onload = callMe();
Bad code, naughty code !
function callMe() { document.getEle mentById('test' ).style.left = "115px"; }
Non-defensive code just waiting to cause a JS error when 'test'
doesn't exist.
May 24 '07 #4
dd
On May 16, 2:08 pm, juergen.rie...@ gmail.com wrote:
following code does not render scrollbars in firefox 1.5.x. Bug?
Workaround other than to innerHTML an absolute positioned element
after loading?
That's what I do and it's reliably calculated the scrollbar size on
NS6,7,8,FF etc. Try this (which declares a global called
ScrollbarOffset ):

window.onload=f unction(){
var outerdiv=docume nt.createElemen t("div");
outerdiv.style. position="absol ute";
outerdiv.style. top="0px";
outerdiv.style. left="0px";
outerdiv.style. width="50px";
outerdiv.style. height="50px";
outerdiv.style. overflow="hidde n";
var innerdiv=docume nt.createElemen t("div");
innerdiv.style. width="100%";
innerdiv.style. height="60px";
outerdiv.append Child(innerdiv) ;
document.body.a ppendChild(oute rdiv);
var noscrolloffset= innerdiv.offset Width;
outerdiv.style. overflow="auto" ;
var withscrolloffse t=innerdiv.offs etWidth;
document.body.r emoveChild(docu ment.body.lastC hild);
ScrollbarOffset =noscrolloffset-withscrolloffse t;
}

May 24 '07 #5
dd
On May 24, 10:57 am, dd <dd4...@gmail.c omwrote:
NS6,7,8,FF etc. Try this (which declares a global called
ScrollbarOffset ):

window.onload=f unction(){
var outerdiv=docume nt.createElemen t("div");
outerdiv.style. position="absol ute";
outerdiv.style. top="0px";
outerdiv.style. left="0px";
outerdiv.style. width="50px";
outerdiv.style. height="50px";
outerdiv.style. overflow="hidde n";
var innerdiv=docume nt.createElemen t("div");
innerdiv.style. width="100%";
innerdiv.style. height="60px";
outerdiv.append Child(innerdiv) ;
document.body.a ppendChild(oute rdiv);
var noscrolloffset= innerdiv.offset Width;
outerdiv.style. overflow="auto" ;
var withscrolloffse t=innerdiv.offs etWidth;
document.body.r emoveChild(docu ment.body.lastC hild);
ScrollbarOffset =noscrolloffset-withscrolloffse t;
FYI to the people who manage the FAQ at jibbering.com, re: item # 4.9
- that example code isn't taking the scrollbars for Gecko browsers
into account. This code above calculates the scrollbar size (which
varies from 15 to 19 pixels).

May 29 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
11190
by: Duane Lambe | last post by:
Hi - just a quick question, I hope it's simple enough that a visual example isn't required. I have an internal site, everything's the way I want it, but there's an anomoly in both Opera and Firefox, which doesn't exist in IE (surprise). Essentially, it's a div being margin:auto-d on the page. #container { padding: 0;
5
4959
by: jvb | last post by:
I hope this is the correct place to ask this question. If not, would some kind person tell me where I should? In IE, one can use the javascript code, "document.body.scroll='yes/no'" to dynamically control the visibility of a window's scrollbars. Is there an equivalent for W3C browsers (in my case firefox 1.0.6) that does not require messing...
6
19360
by: jascar | last post by:
I'm designing a website for myself, and can't seem to get the scroll bars to go away for Firefox without using frames. Anyhelp would be appreciated. FYI. Already tried "scroll=no" in the body tag. Works great for Opera and IE, but doesn't do it for Firefox.
2
3795
by: Ernst Elzas | last post by:
Hello, If these questions have been asked numerous times before, please excuse me, I have not managed to find the information I needed. I'm making a webpage (for now it will only be in two languages, English and Hebrew), and noticed a few issues with scrollbars: I divided the page in divs, with drop-down menus appearing in the top-div:...
0
1681
by: Muhammad Shoaib Ashrafi | last post by:
<div style="width:300px; height:100px; overflow:-moz-scrollbars-vertical; left:100; top:100; position:absolute"> <table width="500" style="position:inherit; border:solid 2PX #006666;"> <tr><td>Test</td><td>Test</td><td>Test</td><td>Test</td><td>Test</td><td>Test</td><td>Test</td></tr>...
9
18194
by: dd | last post by:
Does anyone have a cross-browser solution for hiding scrollbars and/or disabling scroll for the whole page? When the user clicks something, I want to display a DIV that fills the whole client area. While this DIV is displayed, they can close it by clicking the close button on the DIV. During the time this DIV is visible though, I don't...
1
2060
by: houghm | last post by:
Hello, I'm having a problem and I wonder if anyone can help? I have a div on which I have specified {overflow-y:auto; overflow-x:hidden;}. This div contains a table with a varying number of rows. When the rows excede the number which will fit in the div (which also has a height) then the vertical scrollbars appear. In firefox this works...
5
2099
by: brwniydgirl | last post by:
Hi, I have a website that is CSS based, with the main content portion in a div with scrollbars and I've tested it in IE7 as well as Firefox and it appears to work fine on my computer and other computers in my house. However, the scrollbars are not showing up on my client's (old) laptop - she also uses IE7. I can't figure out why that would...
0
7406
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7660
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7813
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7431
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7761
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5337
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3457
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.