Can this be done?

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!

Moderator: General Moderators

Post Reply
illmapu
Forum Commoner
Posts: 47
Joined: Fri Aug 22, 2003 1:48 pm

Can this be done?

Post by illmapu »

Hi,

I have text(field) that I would like to have certain text be hi-lited, does anyone know if this can be done?

Thanks in advance! :lol:
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

do you mean highlighted?

-Nay
User avatar
Jean-Yves
Forum Contributor
Posts: 148
Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK

Post by Jean-Yves »

I assume that you mean a form field, ie <input type='text' etc...

If you create a stylesheet class (eg myclass1) with the required colour, you can then say, for example (red text):

Code: Select all

&lt;style&gt;
 .myclass1&#123;color:#ff0000;&#125;
&lt;/style&gt;

Code: Select all

$option = 1; //change this to use another class, eg green, blue, etc, etc...
echo "<input type='text' name='text1' id='text1' class='myclass$option' />\n";
This would make the text colour (and other attributes, font etc) be what you want. Works on other objects too, such as buttons, <select> tags, etc..

As far as I know however, it is not possible to have just one part of the text highlighted. You'd probably need a java applet or activeX control for that, but that's outside of my experience.
Post Reply