PDA

View Full Version : Textarea problem...



Sikes
February 13th, 2002, 16:32
Ok, look at the following code, it is a form textarea for a "test your html" page, so you put in your html and it shows what it looks like... :

<input type="button" value=" << " onClick="document.form.code.cols-=10" class="button"> <input type="button" value=" < " onClick="document.form.code.cols-=5" class="button"> &nbsp; <input type="button" value=" > " onClick="document.form.code.cols+=5" class="button"> <input type="button" value=" >> " onClick="document.form.code.cols+=10" class="button">
<form action="html-test_ACTION.php" method="post" name="form">
<textarea name="code" cols="60" rows="20" class="textarea" style="font-family:Courier New">
</textarea><br>
<input type="submit" value="Test It!" class="button">
</form>

See where the "<<", "<", ">" and ">>" buttons are, if you read the code, you'll see that it resizes the textarea colums.... It works in IE but I don't think it does in Netscape, I tried it on my school computer (Mac).

So, please tell me why it doesn't work, and if you know how to fix it!



Thanx!

coldturkey
February 13th, 2002, 20:47
why not make it with lots of columns and just use a horizontal scrollbar?

Sikes
February 14th, 2002, 07:39
Because this ads a little feature to my website...

But, how do you add a H-scroller to the TEXTAREA? I knew I did that once, but I forget how.... Or is that what you meant?

Canuckkev
February 14th, 2002, 12:25
Not that I know or anything...but this part doesn't look right to me:

onClick="document.form.code.cols-=10

the "-=" part....

I think what you can do is declare a variable and set it to 60, then make it so when you press one button, it subtracts 10 from the variable, and sets the column width to that new value, and add ten for the other button. That should do it I think...

meow
February 15th, 2002, 20:28
Sikes, someone posted a similar script somewhere else recently. He said the method isn't supported by NS4.