Is there some way --using, say, DOM or javascript-- to detect the
current pixel width and/or height of a relatively sized table or of
one of its columns or rows. I'm going to be writing javascript to
adjust my page to the viewer's browser window dimensions and this
would sure be great information to have.
Thanks ....
Dennis 157 16420
Dennis wrote: Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript to adjust my page to the viewer's browser window dimensions and this would sure be great information to have.
With IE4+, Netscape 6+, Opera 7 you can read
element.offsetW idth
element.offsetH eight
of any element in the page. So try
var element;
if (document.all)
element = document.all['elementId'];
else if (document.getEl ementById)
element = document.getEle mentById('eleme ntId');
if (element) {
// read element.offsetW idth/element.offsetH eight here
}
As your question and the answer is not about HTML but JavaScript I have
crossposted to comp.lang.javas cript and set follow-up to it.
--
Martin Honnen http://JavaScript.FAQTs.com/
"Dennis" <theonlyDennis@ removeForSpam_m indspring.com> wrote in message
news:vv******** *************** *********@4ax.c om... Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript to adjust my page to the viewer's browser window dimensions and this would sure be great information to have.
Why resort to BS javascript trickery when you can just use a flexible
layout?
--
Karl Core
At times one remains faithful to a cause only because its opponents do not
cease to be insipid.
Friedrich Nietzsche
eightninethree AT eightninethree. com
Stan Brown wrote: In article <vv************ *************** *****@4ax.com> in comp.infosystem s.www.authoring.html, Dennis <theonlyDennis@ removeForSpam_m indspring.com> wrote:
I'm going to be writing javascript to adjust my page to the viewer's browser window dimensions
Oh god, here we go again.
Not me. I'm steering clear of this one. :) (Note to op: use Google
to search for recent threads on resolution, browser window, and design.)
--
Brian
follow the directions in my address to email me
I have a long list to put up, and I want as much of it as possible to
be viewable to the user without scrolling. So the wider the user's
window, the more columns I can put up. Now, if there was a setting
that would collapse a table's column at a given width, I could work
with it that way too, but I'd still need javascript to find out how
many columns had been collapsed (eg, had 0 width) --so I'm sort of
back where I started.
On Sat, 11 Oct 2003 08:15:44 -0400, "EightNineThree " <uc*@ftc.gov>
wrote: Why resort to BS javascript trickery when you can just use a flexible layout?
Dennis <theonlyDennis@ removeForSpam_m indspring.com> wrote in
news:op******** *************** *********@4ax.c om: I have a long list to put up, and I want as much of it as possible to be viewable to the user without scrolling. So the wider the user's window, the more columns I can put up. Now, if there was a setting that would collapse a table's column at a given width, I could work with it that way too, but I'd still need javascript to find out how many columns had been collapsed (eg, had 0 width) --so I'm sort of back where I started.
I think we've got an "XY problem" here. An XY problem occurs when there's
confusion between ends and means. Your first problem states your goal in
general terms: you want the user to be able to see as much of your list as
possible without scrolling. That sounds, in the absence of more specific
information about your application, like a reasonable goal. Your next
sentence gets a little more specific: you want to display the list in
columns, with the number of columns increasing with browsing window size.
That's starting to move from ends to means, but it still sounds like a
fairly reasonable implementation. So your "X" is that you want to display
a list as multiple columns, with the number of columns varying according to
window width.
However, you've now jumped from that requirement to the notion that you
need a table to do it, and that you need to dynamically resize the table
with scripting in order to do it. That's your "Y" (a specific
implementation) , but it's not necessarily the only means of achieving your
end. There may be some "Z" that would do a better job. A lot of people
here, through their own sometimes bitter experience, realize that the
particular "Y" you've picked tends to be difficult and unreliable in
practice.
The solution is to tell us about your "X" in more detail. There's a very
good chance that if you do, one or more people here will recognize that
they've already solved the problem in some way that doesn't resemble your
"Y" at all and they'll show you how.
Sure, I'm for anything that works. I got into the table idea because
I've read that detecting the user's overall browser window dimensions
(speaking of X,Y ...) can't be reliably done --or at least efficiently
done without a ton of code. And that was my initital "Y" approach.
My objective here is to have the number of columns increase so as to
accomodate the user's browser width. Actually, given the importance
of reading text, you would think HTML would have a "multi-column wrap"
feature, but apparently it doesn't.
Dennis
On 11 Oct 2003 18:23:53 GMT, Eric Bohlman <eb******@earth link.net>
wrote: Dennis <theonlyDennis@ removeForSpam_m indspring.com> wrote in news:op******* *************** **********@4ax. com:
I have a long list to put up, and I want as much of it as possible to be viewable to the user without scrolling. So the wider the user's window, the more columns I can put up. Now, if there was a setting that would collapse a table's column at a given width, I could work with it that way too, but I'd still need javascript to find out how many columns had been collapsed (eg, had 0 width) --so I'm sort of back where I started.
I think we've got an "XY problem" here. An XY problem occurs when there's confusion between ends and means. Your first problem states your goal in general terms: you want the user to be able to see as much of your list as possible without scrolling. That sounds, in the absence of more specific information about your application, like a reasonable goal. Your next sentence gets a little more specific: you want to display the list in columns, with the number of columns increasing with browsing window size. That's starting to move from ends to means, but it still sounds like a fairly reasonable implementation. So your "X" is that you want to display a list as multiple columns, with the number of columns varying according to window width.
However, you've now jumped from that requirement to the notion that you need a table to do it, and that you need to dynamically resize the table with scripting in order to do it. That's your "Y" (a specific implementation ), but it's not necessarily the only means of achieving your end. There may be some "Z" that would do a better job. A lot of people here, through their own sometimes bitter experience, realize that the particular "Y" you've picked tends to be difficult and unreliable in practice.
The solution is to tell us about your "X" in more detail. There's a very good chance that if you do, one or more people here will recognize that they've already solved the problem in some way that doesn't resemble your "Y" at all and they'll show you how.
Dennis wrote:
Please don't top-post. ... My objective here is to have the number of columns increase so as to accomodate the user's browser width.
set a width to the elements in question and employ CSS: float
--
William Tasso
Brian wrote:
[snip] Not me. I'm steering clear of this one. :) (Note to op: use Google to search for recent threads on resolution, browser window, and design.)
Ensure that your read the following, which didn't get an answer from Brian. It
asks how a person should decide what size to make pixel-oriented content such
as images & photographs:
http://groups.google.c om/gr************* *************** ****@newsfep1-gui.server.ntli .net http://tinyurl.com/qkqe
Have a look at one of Brian's own pages: http://people.umass.edu/btrembla/jardin/garden.html http://tinyurl.com/qkqt
If you view that page, and contract the window on your browser, you will find
that, at about 864 viewport pixels, a horizontal scroll-bar appears. Brian's
page is really designed for quite large screen sizes. That is partly because
of Brian's CSS. Switch off the CSS, and the horizontal scroll-bars don't
appear until the viewport width is down to about 688 pixels.
The basic reason is simple - the photograph on that page is 661 x 391 pixels.
There is nothing wrong with that! There are very few people with 640 x 480
screens, so why bother to cater for them? Nearly half of web users have 800 x
600 screens, so it is a good idea to cater for them. I cannot fault Brian's
decision to base his image size on the screen sizes of the vast majority of
web users. IF that is how he arrived at the particular size! (I hope he didn't
simply make a random decision).
My own view is that, having made the decision to have a photograph size that
fits onto the common screen size, it is wrong to cause further problems by
requiring even larger screen sizes. I wouldn't have CSS that did that. With my
own photograph pages, using photographs that are 700 pixels wide, there are no
horizontal scroll-bars at 800 pixels. But - Brian is allowed to choose
otherwise - his valid choice.
I recently did a brief survey of the widths of web sites. See:
http://groups.google.c om/gr************* *************** *******@newsfep 1-win.server.ntli .net http://tinyurl.com/qks7
Right across the world, major web sites have been (and presumably are still
being) designed on the assumption that the available screen width is up to 800
pixels. There appears to be an implicit assumption that media-type="screen"
means "800 pixels", even among people have who never heard of media types.
Those 800-pixel-wide web site are of all types. Tableless & tables. With &
without CSS. Old & new. Structured with hn, etc, and not. Strict,
Transitional, or no DOCTYPES. HTML or XHTML. The paradigm is "screens are up
to 800 pixels wide".
What are the implications for how we should write HTML & CSS?
--
Barry Pearson http://www.Barry.Pearson.name/photography/ http://www.BirdsAndAnimals.info/ http://www.ChildSupportAnalysis.co.uk/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carl Gilbert |
last post by:
Hi
I am currently writing a site that utilises tables. I have one page
that links to a second page.
The only problem is that when I link to the second page, the table
loads up with a different height than was set in the code.
However, when I use the navigation buttons in IE to go back and then
forward again to the second page, the table is displayed as expected.
|
by: John |
last post by:
I have a table with two rows. On the first row is a text box and in
the second row is an image. I have set the table cellpadding to 0 and
cellspacing to 0.
The table is leaving extra spaces in the rows on the top and bottom of
the picture and image. I need to make the height of the rows to be the
same as the textbox and image. How do I do this? I have tried even
setting the height of the table and all the <td> and <tr> tags to 1
but have...
|
by: ajay |
last post by:
I have following code for a slide menu but i twiked it to work for a
single level menu. Open it in a Browser to get a clear picture.
I have 2 Qs
1) How to make first entry as non-link. i.e i want to make first text
as Table Heading/menu category. For examle in the given menu i want to
make a heading as "Comp. Languages" which won't be a link.
2) The position of this menu is absolute to the page. I want to make
it absolute to the Table...
|
by: andrewkooi |
last post by:
Greetings,
I have 16 links for my horizontal menu navigation as you can see in my
website www.singakad.com and at present, I am using a table and
javascript for this menu.
Is it possible for me to create a submenu for certain cells in this
horizontal menu? How do I go about doing this?
Thank you in advance for any assistance given.
|
by: Norman L. DeForest |
last post by:
Am I misunderstanding the CSS specifications or is Firefox (version 1.0.6)
(and Opera) doing the wrong thing?
It appears that Firefox 1.0.6 includes the border in width calculations
for tables but not in height calculations.
Oh, and Opera version 8.02 does the same thing.
|<-->| |<-->| <------ border
|<------------>| <------ table contents
| |
by: Chifo |
last post by:
hello.
i have a problem with a populate html table with data from table here
it's the problem
two querys retrieving data from table, one of querys show me a
colletion of data from 6:00 am to 15:30 pm timestampz, i put this on a
part of html table. when time on my if condition es great than 15:31,
showme data from 15:31 to 23:59 timestamp and populate another part of
html table.
but, data in html first part,it's gone away.
|
by: outstretchedarm |
last post by:
I'm extremely new to javascript and to programming in general.
I am trying to create an interactive table. I have already created the
table with constants, in the key of C (it is for music). what I would
like to do is to create a dropdown box that would enable the user to
select all 12 keys, then based on that choice, have the whole table
re-calculate, basically transposing all the data up or down.
how would I go about doing this.
|
by: nino9stars |
last post by:
Hello,
I have just started messing with absolute positioning on webpages, and
it definitely let's you do some creative things. Well, after much
searching and help, I got the images I was using to overlap correctly.
You can see it on this page:
www.creativekaysjewelry.com
The images overlap exactly how I wanted and in the right position
|
by: MissMarie |
last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into a div table and after I save it I noticed that the slideshow does not show up and the embed code I added is altered. Can anyone help me figure this out?
The embed code that I'm talking about is three quarters down the code page under {PHOTOS},...
|
by: azura |
last post by:
how can i get this textfield auto detect?? because i try not to using view name button... i want when i enterd this matric no., the student name will appear automatically when i insert the matric no..
<table width="416" height="70" border="1">
<tr>
<td width="87" height="33"><strong>Matric No</strong> </td>
<td width="7"><div align="center">:</div></td>
<td width="300"><input name="matric"...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |