473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

object width and browser compatibility

resending with better URL

At the URL http://www.spfldcycling.org/miles/06_12_detail.htm , I'm having
difficulty resizing a DIV object when the window resizes. I want to get the
left and top positions of the DIV, then calculate the width and height. I
can get the window dimensions fine, but since I can't get the left and top I
had to use constants, which isn't a good idea. Also, the page doesn't work
well in Netscape. The header shifts all the way to the right on top of the
empty corner cell, and the name list sometimes disappears and comes back
again if resized in the other axis. IE is fine. If someone could look at
this and give me suggestions I'd appreciate it. The function with constants
is pasted below.

The page is created by a VB6 program and uploaded via FTP. I put it out with
a debug switch set, so extra spaces and line feeds are included. If the
records keeper uploads again, those will go away, but for the time being the
page source can be easily read.

function redraw() {
if (dd) {
var ww=f_clientWidth();
var wh=f_clientHeight();
if (ww<500) ww=500;
if (wh<500) wh=500;
dd.style.width=ww-160;
dd.style.height=wh-175;
hh.style.width=ww-175;
nn.style.height=wh-190;
}
}

dd is set at the end of the page by:

var hh=document.getElementById('head');
var nn=document.getElementById('names');
var dd=document.getElementById('detail');

--
dgm
Dec 23 '06 #1
2 1459
>From: David McDivitt <da*******@del-subjectivist.org>
>Date: Sat, 23 Dec 2006 15:55:51 -0600
Lines: 39

resending with better URL

At the URL http://www.spfldcycling.org/miles/06_12_detail.htm , I'm having
difficulty resizing a DIV object when the window resizes. I want to get the
left and top positions of the DIV, then calculate the width and height. I
can get the window dimensions fine, but since I can't get the left and top I
had to use constants, which isn't a good idea. Also, the page doesn't work
well in Netscape. The header shifts all the way to the right on top of the
empty corner cell, and the name list sometimes disappears and comes back
again if resized in the other axis. IE is fine. If someone could look at
this and give me suggestions I'd appreciate it. The function with constants
is pasted below.

The page is created by a VB6 program and uploaded via FTP. I put it out with
a debug switch set, so extra spaces and line feeds are included. If the
records keeper uploads again, those will go away, but for the time being the
page source can be easily read.

function redraw() {
if (dd) {
var ww=f_clientWidth();
var wh=f_clientHeight();
if (ww<500) ww=500;
if (wh<500) wh=500;
dd.style.width=ww-160;
dd.style.height=wh-175;
hh.style.width=ww-175;
nn.style.height=wh-190;
}
}

dd is set at the end of the page by:

var hh=document.getElementById('head');
var nn=document.getElementById('names');
var dd=document.getElementById('detail');

I resolved the position issue with the code pasted below. I forgot the left
values were relative to the parent. And for some reason, Netscape works now,
too! I didn't change the part Netscape didn't like but what the hell. If
resized too small horizontally, Netscape will squeeze the name column, then
not restore if sized back out again. With Netscape the DIV ending sizes
leave different space to the edge of the window, varying randomly from one
resize to the next, but it doesn't look bad. It's just not consistent in
Netscape. But I'm happy. A constant of 10 gives a nice margin to the window.
The constant of 25 is 10 plus the width of the scrollbar.

function redraw() {
if (dd) {
var ww=f_clientWidth();
var wh=f_clientHeight();
if (ww<500) ww=500;
if (wh<500) wh=500;
var calc=ww-left(dd)-10;
if (dd.style.width!=calc) dd.style.width=calc;
calc=wh-top(dd)-10;
if (dd.style.height!=calc) dd.style.height=calc;
calc=ww-left(hh)-25;
if (hh.style.width!=calc) hh.style.width=calc;
calc=wh-top(nn)-25;
if (nn.style.height!=calc) nn.style.height=calc;
}
}
function left(ob) {
var sum=0;
var o=ob;
while (o) {
sum+=o.offsetLeft;
o=o.offsetParent;
}
return sum;
}
function top(ob) {
var sum=0;
var o=ob;
while (o) {
sum+=o.offsetTop;
o=o.offsetParent;
}
return sum;
}

--
dgm
Dec 24 '06 #2
>From: David McDivitt <da*******@del-subjectivist.org>
>Date: Sat, 23 Dec 2006 19:40:35 -0600
Lines: 89

I resolved the position issue with the code pasted below. I forgot the left
values were relative to the parent. And for some reason, Netscape works now,
too! I didn't change the part Netscape didn't like but what the hell. If
resized too small horizontally, Netscape will squeeze the name column, then
not restore if sized back out again. With Netscape the DIV ending sizes
At this page http://www.spfldcycling.org/miles/06_12_detail.htm , I noticed
the text screws up when scrolling horizontally, in IE, if the browser zoom
is not 100%. The text screws up but the cell borders travel where they
should. Now I have to include a note saying to insure zoom is 100%. Is there
a way to see what the zoom value is so I can display a warning?

--
dgm
Dec 24 '06 #3

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

Similar topics

16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
8
by: AC | last post by:
I hope someone can tell me why this is not working. I have a form that dynamically creates the code below. This is for one product and there are about 10 to 50 products that are listed depending...
1
by: Brian Rosenthal | last post by:
I'm having a browser compatibility issue with NS 4.72. I cannot seem to get a frame of 1 px width. Does anyone know what the compatibility workaround is here? Here's the page in question:...
11
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after...
5
by: fred | last post by:
I don't know if I'm doing this correctly. I have a little programming experience in python, c++ and some others but this is my first time with javascript. I'm trying have my website detect the...
1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
1
by: laredotornado | last post by:
Hello, I"m looking for a cross-browser (Firefox 1+, IE 6+, Safari whatever+) to calculate the width of the viewable browser area. Note that this is different than the screen width, which would...
2
by: laredotornado | last post by:
Hello, I am looking for a cross browser way (IE, Firefox, Safari) of getting the screen width, in pixels, of an element on my page. I am interested in the "navImg" table cell. Here is a snippet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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
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...
0
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
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,...

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.