Zhang Xin

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromZhang Xin
ToMe
SubjectHow to get column's runtime width of a table in HTML
Date17 January 2005 13:19
Dear Mark,

I found your wonderful website by Google search. 

The problem I'm facing is, I need get column's runtime width of a table in
HTML, because the table column may be enlarged by its content. 

I tried this: document.getElementById('column1').currentStyle.width

but it just return the fixed width specified by width property, e.g., '10%',
or '30px', or 'auto' if I don't specify the width property. 

Is there a way to get the runtime width of a column in a HTML table? Thanks
for your help!


Best Regards,
Zhang Xin
FromMe
ToZhang Xin
SubjectRe: How to get column's runtime width of a table in HTML
Date17 January 2005 13:40
Zhang,

Firstly, be careful; currentStyle is non standard and only supported by
Internet Explorer.

The way to check the actual width of a column is to reference a cell within
it, and check the offsetWidth property:

document.getElementById('cell1').offsetWidth

This should work in all major browsers.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromZhang Xin
ToMe
SubjectIs it possible to change html radio button to square?
Date10 May 2005 11:39
Dear Mark,

I found your wonderful website by Google, and I consulted you before and got
very helpful suggestions from you.

One more thing need your help now  :-) 

Do you think it's possible to change the shape of html radio button from
round to shape (like checkbox) by using style? We're facing a very captious
user here.

Many many thanks.

Best Regards,
Zhang Xin
FromMe
ToZhang Xin
SubjectRe: Is it possible to change html radio button to square?
Date10 May 2005 16:43
Zhang,

> Do you think it's possible to change the shape of html radio button
> from round to shape (like checkbox) by using style?

In theory, you could use the CSS3 border-radius:0px; property, but this will
not work in any browser (Mozilla's -moz-border-radius will not work either).

There are two ways this can be done, and I do not recommend either of them.

1. use images and scripts to toggle between checked and unchecked images.
And of course, don't forget that they look totally different on different
operating systems.

2. use scripts to make real checkboxes behave like radio buttons

(I can also think of some worse ways to do it, such as using a plugin -
urgh! - or carefully overlayed images to simulate the border - too hard)

This is a very bad thing to do though. You will confuse users, because they
will see one type of control (a checkbox) but it will not behave the way
they expect. This is a usability problem, and should be avoided.
Aditionally, both ways rely on JavaScript and one way relies on images as
well. They both cause accesibility problems. If at all possible, persuade
your client that it is a bad idea, or alternatively tell them that it cannot
be done at all.

Tarquin
FromZhang Xin
ToMe
SubjectRe: Is it possible to change html radio button to square?
Date11 May 2005 03:34
Dear Tarquin,

Thank you for your detail explaination. Really appreciated it.

You're really a expert and considering wider (e.g., usability,
accesibility). I will quote your suggestion and try to persuade my client.

Thank you again.

Best Regards,
Zhang Xin
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.