Javascript and Textarea tricks?

Hi all,

I’m pretty new to JS but am wondering if anyone knows either of these tricks to be possible or not…

  1. Having a JS function that color-codes text in a textarea as it is entered? (eg, “hello” is made red, “my name is” is turned blue…etc)

  2. Creating alternating line background colors… every time a new line is added, it’s highlighted with some color or left blank, creating alternating row colors for each line you add

  3. Creating a button in JS that would paste a value from the JS doc to some place in the textarea (eg, you have a button labeled “greet” and when you press it, is pastes “hello” into the textarea in which your cursor resides

I know these are very different functions but I’m just wondering how flexible JS is and if it’s possible to build out these sorts of functions. Thanks in advance for any help you may be able to lend =)