LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Can I dynamically size HTML input fields? (https://www.linuxquestions.org/questions/programming-9/can-i-dynamically-size-html-input-fields-507967/)

Madone_SL_5.5 12-06-2006 02:40 PM

Can I dynamically size HTML input fields?
 
This is probably a really simple question.

I am wondering if there is a way to make my <input> fields size dynamically.

For example, I have a page such as this:

Code:

<HTML>
  <BODY>
      <FORM ACTION="whatever" METHOD="POST">
      <TABLE>
      <TR>
      <TD>
      <INPUT CLASS="whatever" VALUE="whatever" SIZE="20" NAME="whatever">
      </TD>
      </TR>
      </TABLE>
      </FORM>
  </BODY>
</HTML>

How do I make that size dynamically (i.e. to a percentage of the page) as windows are sized, or for different viewing resolutions?

gizza23 12-06-2006 04:53 PM

I think that that's possible with AJAX because, in theory, it provides the capabilities of dynamism that you want. Unfortunately it would be difficult to gauge when to expand the form because most text formats and multispaced rather than a predictable monospace.

AdaHacker 12-06-2006 06:32 PM

Simple: instead of using the size attribute, use CSS and set the width as a percentage. For example:
Code:

<input type="text" name="foo" value="bar" style="width: 50%" />


All times are GMT -5. The time now is 03:28 PM.