Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expanding the Textarea

Status
Not open for further replies.

siris

Programmer
Aug 13, 2004
10
IN
I have a text area like this

<textarea rows=4 name=txtAction cols='67%'></textarea>

but instead of the percentage I want to expand the textarea element to certain pixels. I know that my screen width is 1024. Now if I want to expand the text area to 550 pixels, how can I do that. Any help would be highly appreciated.

thanks.
 
here are some examples:

this is the source from my site:

<textarea name=&quot;feedback&quot; wrap=&quot;VIRTUAL&quot; style=&quot;width: 300px; height: 108px&quot;></textarea>

this is the source from THIS page:

<TEXTAREA COLS=60 ROWS=14 NAME=&quot;post&quot; WRAP=&quot;virtual&quot;></TEXTAREA>

2 different ways to accomplish the same thing. what you want would be more or less like the first example.
hope this helps.

- milech
 
You could also make the field dynamic by changing the size based on the screen size. This sample just takes the screen size and divides it by 4.

<head>
<SCRIPT LANGUAGE=javascript>
var wid = screen.availWidth/4
var hig = screen.availHeight/4
function setH(){
document.formName.feedback.style.height=hig
document.formName.feedback.style.width=wid
}
</script>
</head>
<body onLoad=&quot;setH()&quot;>
<form name=&quot;formName&quot;>
<textarea name=&quot;feedback&quot; wrap=&quot;VIRTUAL&quot; style=&quot;width: 30px; height:10px&quot;></textarea>
</form>

Just another option
Roj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top