i have a text area and i want some buttons above it, when clicked, those buttons will insert stuff into the text area, ie: if u click a button called "Bold", it'll insert into the text area. Anyway i can do this?
Printable View
i have a text area and i want some buttons above it, when clicked, those buttons will insert stuff into the text area, ie: if u click a button called "Bold", it'll insert into the text area. Anyway i can do this?
It's a simple event handler. Here's a tutorial on this:
http://javascriptkit.com/javatutors/event1.shtml
And here is a working HTML editor in JS that is similar to what I think you want to do:
http://javascriptkit.com/script/cut59.shtml
Quote:
<input type="button" value=" Bold " onClick="bold()">
<input type="button" value=" Italics "
onClick="italic()">
<input type="button" value=" Underline " onClick="underline()">
<input type="button" value=" Preformatted " onClick="pre()">
<input type="button" value=" Center " onClick="center()">
<input type="button" value=" Horizontal Bar " onClick="hbar()">
<input type="button" value=" Line Break " onClick="lbreak()">
<input type="button" value=" Paragraph Break" onClick="pbreak()">