Example:[code=php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript" type="text/javascript"> <!-- function selColor(sel,selIndex,tArea){ tArea.style.color=sel.options[selIndex].value; } //--> </script> </head> <body> <form> <select onchange="selColor(this,this.selectedIndex,this.form.text)"> <option value="black">black</option> <option value="green">green</option> <option value="yellow">yellow</option> <option value="red">red</option> <option value="gray">gray</option> <option value="blue">blue</option> </select><br> <textarea name="text" cols=50 rows=12></textarea><br> </form> </body> </html>[/code]You will have to use the value of the selected option in your server side script to format the text in your output frame as well.
That's what I said:You will have to use the value of the selected option in your server side script to format the text in your output frame as well.[/QUOTE]I don't know what server side language you are using and I don't know, what you output. If you use spans or divs for the output, you will need to have your server side script add css properties for the container with the text to be displayed.
Assuming, your form's method is "get" and you name the select tag "textColor", you could use something like that:[code=php]<?php $color=$_GET['textColor']; $text=$_GET['text']; echo '<div style="color:'.$color.'">'.$text.'</div>'; ?>[/code]I put a simple example online, using the above snippet: http://www.pit-r.de/scripts/ysherazi/dropdownForColorInTextarea.htm
I'm using onclick for refreshing my input page but am also using dropdown menu to change the color of the text but when I write text and chooose colour it changes but once I submit text it changes to black againbecause it is default.
can you guide me what should I do so that when I submit value it should stick with the color I choose.
mesg page is used to show output. I'm passing the colour value to msg page but because of refresh it turn back to black