开发者

how to get font color changing script just like mail box?

I need to add a font color changing tool section in my form's text area same as we have in our mail boxes.I 开发者_C百科tried to find on net but didnt get anything useful.Please tell me how can i implement that font color changing tool on my page using javascript????


Simplest way would be to use something like: http://developer.yahoo.com/yui/examples/editor/simple_adv_editor.html


Color pickers are readily available on the net. Just google for "colorpicker yourFavJSLib". Some results will be:

  • http://www.dojocampus.org/explorer/#Dijit_Color%20Palette_Default
  • http://developer.yahoo.com/yui/examples/colorpicker/index.html
  • http://www.eyecon.ro/colorpicker/

Basically, all you have to do is let the user pick a color and then change the CSS color property with JavaScript for that eMail. You will also want to save the color value for this eMail on the server so it gets reapplied when the page is reloaded.

As an alternative, let users tag their eMails and let them assign colors to the tags instead of the eMail directly. Then store the tags instead of individual colors. Apply the tags as CSS classes.

EDIT: if you want the users to allow for RichText Editing/Composing, either use a readymade component. If you cannot use one, use a color picker and wrap the selected text portion into 'span' tags - but there's really no reason to reinvent the wheel here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜