PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Does anyone know of a way to change the colour (or 'color' for our American friends out there) of certain parts of text in an HTML textarea created from PHP?
you can't. you might try looking though for a javascript/javaApplet/ActiveX application that you could plug into your page and that might allow you to something like that.
about the php button, not sure. jason may be doing some redesigning of the site. we'll see.
The color changing thing can be done, it won't change the color in the input box itself but on the output, not sure how though...str_replace() maybe?. And I was talking to jason earlier today and he is indeed changing the phpBB system around, upgrading to a newer version...Have fun.
<html>
<head>
<style type='text/css'>
.myownstyle // you need to add class='.myownstyle' to all textareas to which you want to apply this style (ofc you might want to make multiple styles, one for each textarea)
{
font-family: 'Times New Roman", Times, serif;
font-size: 10px;
text-transform: capitalize;
color: #0099ff;
text-decoration: line-through;
background-color: #00FFFF;
}
</style>
</head>
<body>
<textarea name='whatever' class='.myownstyle'></textarea>
</body>
</html>
i gave you some of the available options though they are not all that you can configure for a textarea. consult a css manual for more details.
I suppose if you want to include styles on the fly with PHP you could always parse the textarea tag to write in a style attribute, or write the class attribute.
btw DaZZleD, I think that class=".myownclass" should be class="myownstyle", the dot is to differentiate between tags and classes when declaring, not when using.
laserlight wrote:btw DaZZleD, I think that class=".myownclass" should be class="myownstyle", the dot is to differentiate between tags and classes when declaring, not when using.
it was a typo...
to answer the question, you cannot change just a part of the textarea text. it's either all or none.
But all I want is 'enry 'iggins 'ead!"
"Done," says the King with a stroke.
"Guard, run and bring in the bloke!
Then they'll march you, 'enry 'iggins to the wall;
And the King will tell me: "Liza, sound the call."
As they lift their rifles higher, I'll shout:
"Ready! Aim! Fire!"
Oh ho ho, 'enry 'iggins,
Down you'll go, 'enry 'iggins!
Just you wait!
volka wrote:But all I want is 'enry 'iggins 'ead!"
"Done," says the King with a stroke.
"Guard, run and bring in the bloke!
Then they'll march you, 'enry 'iggins to the wall;
And the King will tell me: "Liza, sound the call."
As they lift their rifles higher, I'll shout:
"Ready! Aim! Fire!"
Oh ho ho, 'enry 'iggins,
Down you'll go, 'enry 'iggins!
Just you wait!
Yeah, and 10 minutes later she changes her tune to:
"I could have danced all night."
"I could have danced all night, and still have begged for more."
"I could have spread my wings and done a thousand things,"
"I've never done before."
Just proving once again that people aren't very stable to begin with.