473,504 Members | 13,601 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:100px;height:100px;position:absolute; border:1px
solid black;overflow:auto'>
<div id='test' style="position:absolute;top:0px;left:30px">X</div>
</div>
<script>
onload = function(){
document.getElementById('test').style.left = "115px"
}
</script>
</body>
</html>

May 16 '07 #1
5 6886
*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:100px;height:100px;position:absolute; border:1px
solid black;overflow:auto'>
<div id='test' style="position:absolute;top:0px;left:30px">X</div>
</div>
<script>
onload = function(){
document.getElementById('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>Testing JavaScript</title>
</head>
<body>
<div style='width:100px;height:100px;position:absolute; border:1px solid black;overflow:auto'>
<div id='test' style="position:absolute;top:0px;left:30px;">X</div>
</div>
<script type="text/javascript">
onload = callMe();
function callMe() { document.getElementById('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.getElementById('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=function(){
var outerdiv=document.createElement("div");
outerdiv.style.position="absolute";
outerdiv.style.top="0px";
outerdiv.style.left="0px";
outerdiv.style.width="50px";
outerdiv.style.height="50px";
outerdiv.style.overflow="hidden";
var innerdiv=document.createElement("div");
innerdiv.style.width="100%";
innerdiv.style.height="60px";
outerdiv.appendChild(innerdiv);
document.body.appendChild(outerdiv);
var noscrolloffset=innerdiv.offsetWidth;
outerdiv.style.overflow="auto";
var withscrolloffset=innerdiv.offsetWidth;
document.body.removeChild(document.body.lastChild) ;
ScrollbarOffset=noscrolloffset-withscrolloffset;
}

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

window.onload=function(){
var outerdiv=document.createElement("div");
outerdiv.style.position="absolute";
outerdiv.style.top="0px";
outerdiv.style.left="0px";
outerdiv.style.width="50px";
outerdiv.style.height="50px";
outerdiv.style.overflow="hidden";
var innerdiv=document.createElement("div");
innerdiv.style.width="100%";
innerdiv.style.height="60px";
outerdiv.appendChild(innerdiv);
document.body.appendChild(outerdiv);
var noscrolloffset=innerdiv.offsetWidth;
outerdiv.style.overflow="auto";
var withscrolloffset=innerdiv.offsetWidth;
document.body.removeChild(document.body.lastChild) ;
ScrollbarOffset=noscrolloffset-withscrolloffset;
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
11186
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...
5
4958
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...
6
19356
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...
2
3793
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...
0
1675
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;">...
9
18191
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...
1
2051
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...
5
2098
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...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
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...
0
7298
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,...
0
7366
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...
0
7471
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...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
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...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.