Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>Automatically generates color tags(<color="red">,</color>)

Automatically generates color tags(<color="red">,</color>)

joonstar
11-24-2005, 05:42 AM
code

<form action='action.cfm' method='post'>

<select name='color'>
<option value='colors'>colors</option>
<option value='green'>green</option>
<option value='blue'>blue</option>
<option value='red'>red</option>
</select>

<textarea name='box'></textarea>


</form>let's suppose I have the above code.
If a user opens the file above in browser, it will show a color selection box, and a textarea box.
I like to make it like the following.

If a user writes the following sentence

"I like to write this sentence in red." into the textarea, and drags his or her mouse from "I like ~" to "~sentence." and select "red" in the selection box, then
<color="red"> and </color> are automatically generated and surround the sentence.

So it will look like the following.

<color="red">I like to write this sentence in red.</color>

Can I make it in javascript with your help? How?

felgall
11-24-2005, 09:56 PM
There is no such thing as a <color> tag. Colour like all display options are defined in the stylesheet. You can of course set up Javascript to apply the appropriate stylesheet class to different parts of the page.

The following is part of what you might use:

<style>
.red {color:#f00;}
.green {color:#0f0;}
.blue {color:#00f;}
</style>

<script type="text/javascript">
function changeColour(field,colour) {
document.getElementById(field).className = colour;
}
</script>

joonstar
11-24-2005, 10:15 PM
There is no such thing as a <color> tag. Colour like all display options are defined in the stylesheet. You can of course set up Javascript to apply the appropriate stylesheet class to different parts of the page.

The following is part of what you might use:

<style>
.red {color:#f00;}
.green {color:#0f0;}
.blue {color:#00f;}
</style>

<script type="text/javascript">
function changeColour(field,colour) {
document.getElementById(field).className = colour;
}
</script>No, no. whether <color=red> is a real tag or not is not matter because I will transfering "<color=red>" into "<font color=red>" or "<span class=red>" when it is saved into database.

The main matter of my question is automatically generating " <color=red> " into the textarea box while a user write his or her message into the textarea box by using selecting option box.


 

TOP

Hyperthreading hurts s
HP sharpens blade PC l
Apple goes for Quad po
Itanium gets scaled do

For more info

Hyperthreading hurts s
HP sharpens blade PC l
problem with an ImageP
Modifying a navigation
convert text to intege
Anyone knows to clear 
Automatically generate
document.getElementByI
Hi question about stor
Netscape Problems :-( 

News Archive

Month and Year drop do
navigation button/imag
doubt in window.open()
undo redo script 
Mimick "View Source" w
print Question 
No-image representatio
What's wrong with this
Urgent help in Javascr
Gurt Menu assistance 

Related stories:

Anyone knows to clear the contents of the window !!! in javascript
document.getElementByID() Issues
Adding onclick stuff to an INPUT through javascript
Netscape Problems :-(
problem with an ImagePreview js
Can function RETURN a value?
do I need a random script script or not?

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics