The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

This can be done fairly easily in MSIE (in a way that will not disturb Netscape -- it just won't expand the field in Netscape). For a cross-browser solution, you're getting into more complex issues of DHTML (which aren't really worth discussing for such a minor interface feature).

Let me know if the MSIE-only (and Netscape 6, incidentally) solution is acceptable and I'll consider printing it in an upcoming Tech Times (unless someone beats me to it and posts the code here, in which case they'll get well-deserved karma).

Reading back on my prior question, I don't even understand what I was saying. It must be that niquil...makes you feel real groggy. Anyway, I'll try to reword it to make more sense.

Ok, I don't think the problem lies in expanding the text box--that can be done with javascript through a form or dHTML fairly easily (I think), but how do you detect when you need to expand the textbox. For example, let's say that the text box is there allowing big letters, and 5 letters fit in the textbox at once (in otherwords, all 5 letters are showing), but on the 6th letter, we want the textbox to expand, right? Well, without manually telling the computer when to expand the text box (after the 5th letter), how can we tell it to expand?

Yes I do see what you mean, and unfortunately the DOM provides no way of determining the actual pixel width of a text field's contents. You might have a shot at doing it if you coded the field entirely from scratch using DHTML, but that's just crazy.

Yeah, that's what I am talking about. ALso, is the discrepency between how each browser interprets the "length" attribute of an input box. I've noticed there's a fairly wide discrepency there, and I have used the style="width:100px" property for IE before, but NN 4 just ignores that. And along with that, if I use the CSS width property with NS 4, it moves the textbox so that nothing can be on the same line.

You'd be going crazy capturing keyboard events with a DIV and rewriting the contents of the DIV to reflect the changes. You'd have to handle everything with JavaScript, from the cursor to cut and paste. It just isn't worth it. Instead, consider providing little arrow buttons that allow the user to manually extend/contract the field size.

Well, I didn't mean that...what I meant by a writeable div was that isn't there an attribute for <div>'s that allows you to make it writeable (like a form element), where the user can type info into it? Maybe I'm just dreaming, though

Doing the two arrows below a textfield to expand/contract is a good idea. I'll see what I can come up with that is if someone else doesn't beat me.