PDA

View Full Version : textarea size



optikalefx
02-07-2008, 04:35 PM
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!