SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Mar 14, 2001, 16:30 #1
- Join Date
- Feb 2001
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi, I have a textarea, and with CSS I've assigned a background and a color.
Now is there a way to assign to this textarea a rows and cols value ?
I need the CSS value to have priority over the regular textarea values.
Thanks,
Sharg
-
Mar 14, 2001, 17:27 #2
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
With CSS, I really doubt it. However, it can be done in JavaScript using something like this (replacing the "myNames" with the names of your form and textarea)...
document.myForm.myArea.rows = "40"
document.myForm.myArea.cols = "30"
Let me know if you need more details on the JavaScript solution.
-
Mar 14, 2001, 18:03 #3
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
scrubz...
Would your answer would work if there are values already assigned in the textarea tag? I would bet it would not work. I am guessing he wants this solution to some sort of code that he HAS to embed.Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Mar 15, 2001, 09:52 #4
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Good news: It does work if there are already values for rows and cols in the textarea tag. Bad news: It doesn't work at all in Netscape 4.x (although there may be a solution if I spent some time with it).
An example:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
<!--
function changeTextarea() {
var theArea = document.myForm.myArea
if (theArea.rows == "30" && theArea.cols == "50")
{theArea.rows = "15"
theArea.cols = "10"}
else
{theArea.rows = "30"
theArea.cols = "50"}
}
// -->
</script>
</head>
<body>
<form name="myForm" method="post" action="">
<input type="button" value="Resize Textarea" onClick="changeTextarea();"><br>
<textarea name="myArea" rows="15" cols="10"></textarea><br>
</form>
</body>
</html>
-
Mar 15, 2001, 10:06 #5
- Join Date
- Feb 2001
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for your answer.
The main reason I asked was because Netscape 4.x was causing me some troubles already !.
Sad that people are still using it.
-
Mar 15, 2001, 10:34 #6
- Join Date
- Feb 2001
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
maybe we can't do anything about netscape, as long as some users still use them. Take care also with the number of cols, as netscape and explorer behave diffent with each one. A textarea of 60 cols is not the same width in netscape and in explorer.
-
Mar 15, 2001, 13:50 #7
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
why doesn't Netscape just ask people to stop using their own browser?
if they would just lay down and die, then things would be MUCH easier...Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Mar 16, 2001, 22:24 #8
- Join Date
- Jul 2000
- Location
- Singapore
- Posts
- 2,103
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hmm..I don't understand...why can't you just specify it using the normal html method?
You could try the width element of CSS1 though.
I haven't tried it, but it works for netscpae, mozilla and ie browsers when used on <input> fields."Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
-- Albert Einstein
Bookmarks