tags:

views:

48

answers:

1

i have a textarea, now want to provide the user with facility to change the font size,style etc. when i click on a button it should pop up the font dialog box.

    <html>
    <body>
    <form name="abc">
    <textarea name="text">loaded text here</textarea>
    <input type="button" onClick=""> chnage font
    </form>
    </body>
    </html>

i found thid code in http://www.smokyhosts.com/forums/showthread.php?t=740 by Lixas but it changes the textbox height and width when i change the text size

<html>
<head>
    <style type="text/css">
        body, td, tg, input, select {
            font-family: Verdana;
            font-size: 10px;
        }

</style>
</head>
<body onload="initPosition(document.forms[0].txtLayoutViewer)">
<form>
Change Font Size: 
<select onchange="this.form.txtLayoutViewer.style.fontSize = this.options[this.selectedIndex].value; initPosition(this.form.txtLayoutViewer);">
<option value="10">10px</option>
<option value="12">12px</option>
<option value="14">14px</option>
<option value="16">16px</option>
<option value="18">18px</option>
<option value="20">20px</option>
<option value="24">24px</option>
<option value="36">36px</option>
</select>


<textarea name="txtLayoutViewer" rows="15" cols="75" wrap="off">Any text u want to see how it changes.</textarea>
</form></body></html>

Thanx to Christian textarea doesnt change now...using similar method is it possible to change the text font style (like bold, italic, regular, bold italic) and font face (times new roman , lucida handwriting) ????

thanx in advance

-subanki

A: 

to prevent the size beeing changed from the second example you need to set width and height instead of rows and cols.

<textarea name="txtLayoutViewer" style="width:500px;height:300px"
                      wrap="off">
  Any text u want to see how it changes.
</textarea>

using proper css would make it a bit cleaner.

Christian
thanx a lot friend
subanki