Jump to content

ok new thing, dynamic textareas


optikalefx

Recommended Posts

Ive been looking around, and I really wanted a textarea that extends horizontally as you type only to the page width of course, and when you hit enter, the textarea extends vertically. Moreover, i wrote a script that takes the innerHTML of an element and places it in a textarea, how can i make the 'dynamic' textarea become the size of the text it inherited.

 

here is an examle of an extending textarea that doesnt work in FF but does in safari.

http://www.felgall.com/jstip45.htm

 

here is my get page width

var pageX = (document.all)?document.body.offsetWidth:window.innerWidth;

and right now heres how im setting the width and heigh of the textarea

style_w = (document.getElementById(cur_id))?document.getElementById(cur_id).offsetWidth:window.innerWidth;
style_h = (document.getElementById(cur_id).style.offsetHeight);

and then applying it to the textarea, element y

 

y.style.width = style_w;
y.style.height = style_h;

thanks to anyone who can help me out!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.