473,387 Members | 1,520 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,387 software developers and data experts.

How to find the cell's width and position

Hello,

I have a table with width as 98% and all cell widths as 120. However,
these cell widths change with resolution changes. I have to find the
current cell width and its left position. Is there a browser
independent way to do that?

Best Regards,
Asra Baig
Jul 23 '05 #1
1 2106
Asra wrote:
Hello,

I have a table with width as 98% and all cell widths as 120. However,
these cell widths change with resolution changes. I have to find the
current cell width and its left position. Is there a browser
independent way to do that?

Best Regards,
Asra Baig


When you write the table, use server-side code to divide the number of
columns by 100 and make each column that percentage wide:

<table ... width="98%">
<tr>
<%
var numberOfColumns = <some calculation>;
var columnWidth = Math.floor(100 / numberOfColumns);
for (var i = 0; i < numberOfColumns; ++i) {
Response.write(
'<th width="' + columnWidth + '%">' +
columnNames[i] +
'</th>'
);
}
%>
</tr>

Now everything will scale nicely regardless of the browser width.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

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

Similar topics

7
by: Priti | last post by:
<td align="center" bgcolor="#6699cc" onMouseOver="white4.bgColor='#ffffff'" onMouseOver="this.bgColor='#993300'" onMouseOut="this.bgColor='#6699cc'" onMouseOut="white4.bgColor='#6699cc'"> I am...
1
by: Anna K. | last post by:
Hi Experts, I'm new to JavaScript and web-based apps development, so I'll tell you right off that I don't really know my way around it as of yet. I'm trying to create a code library set with...
2
by: ted | last post by:
Hi, Was wondering if it's possible to find the left position of a table cell if the cell is created dynamically. I have a table with a single cell. When a button is clicked, I'd like to add...
7
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t = document.createElement("TABLE"); t.style.position =...
3
by: Robert | last post by:
Hi, I am trying to add a background to a cell that contains multiple horizontal coloured layers on top of eachother. I managed to do this in IE, but firefox displays something very different...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
2
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...
4
by: estragon | last post by:
I am trying to put a transparent gif on top of a jpg, both inside a table cell. Here is the code: <table width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="#121663"> <tr> ...
8
by: webster5u | last post by:
Hi, I'm encounter a problem here. I hope somebody able helping me. i'm put a "log out" hyperlink overlap a image and that particular image is inside a table cell. I also try align the hyperlink on...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.