[solved]help with automated highlighting
Posted: Wed Sep 06, 2006 7:53 am
I have a variable which I load some text into. I would like it to highlight a specific word that the user supplies. I will give you and example.
I would like to automatically select out a would which is typed into an input box on the page before, so if the user input 'contribute' I would like the output to look like this:
Hope this is clear and any help would be greatly appreciated.
Code: Select all
<?php
$contents = ""Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed turpis. In mattis aliquet felis. Nunc sagittis urna ac felis. Phasellus sed contribute velit. Donec orci sem, tempus pharetra, fermentum nec, pellentesque vitae, massa."
?>Code: Select all
<?php
echo "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed turpis. In mattis aliquet felis. Nunc sagittis urna ac felis. Phasellus sed <span class=\"exactMatch\">contribute</span> velit. Donec orci sem, tempus pharetra, fermentum nec, pellentesque vitae, massa."
?>