473,396 Members | 2,147 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.

JavaScript - dynamic resizing of cells in html table

Hello everybody,

I am new at javascript and I would like to write a script that resizes the input fieds of an html table depending on the entered text. The input fields are placed in table cells (using <tr> and <td>) arranged like an Excel sheet.

Requirements to my script are the following:

1- When an entered text is longer than the length of the input field (there is overflow), then the script should automatically insert a linebreak and continue entering at the next line of the field; of course the field has then to be higher (value of height attributeincreases), so that the whole text is visible.

2- If the cell of an input field becomes becomes higher then all cells in the same row must have the same height

3- If text of an overflowed input cell is partially delete so that the text length is now smaller than cell length, the height of the cell should then be decreased to the standard length and height.


4- the automatic resizing of a cell in a row should not affect the size of cells that are not in that row

Does somebody knows where I should begin? How does one perform such a task using JavaScript?

Thank you for your help. I am really desperated

Regards
Nov 25 '08 #1
2 3679
Dormilich
8,658 Expert Mod 8TB
1 - how about a <textarea>? this does self wrap if the text is longer than its width. (plus you do not have to remove the line breaks later...) and I'm not sure if you get more than one line in a text input field.
2 - use DOM to get all elements in the same row (first get the row which contains your element, then access all relevant elements within that)
3 - just make the textarea high enough, imho some scrolling is acceptable.
4 - see 2

regards
Nov 25 '08 #2
Hi Dormilich,

thanks for your answer. I will try your suggestion and give then feedback.
Bye
Nov 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Henk Verhoeven | last post by:
(Reply on this newsgroup to an email - reply by email did not work) Wolfman wrote: > > Hi, > I found your Email in the php Newsgroup. > I was looking for some way to resize some graphiks on my...
0
by: TJ Talluto | last post by:
<facts> I have a "month calendar" that always displays exactly 42 days... and alongside is a vertical box that displays the detail (form fields) of any particular select event that appears on the...
5
by: damonl73 | last post by:
Hi. I'm relatively new to asp.net and very new to javascript. I'm attempting to modify table cells after my page has loaded. Here is the javascript code within my asp.net page which runs OnLoad:...
3
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
1
by: dschectman | last post by:
I have a page with two dynamic tables. One is a master list of items for selection. The second is a list of selected items. The master list contains 4 columns. 1) The item code - hidden For...
4
by: bboyle18 | last post by:
Hi, I am working with a table sorting script which can be found here http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting This script works very nicely, but when there is a...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
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: 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...
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
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
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.