<style type="text/css">
body{
    margin: 3px;
}
.bg0{
    color: #fff;
    font: bold 30px verdana;
    border: 1px solid #000;
    background: #f00;
}
.bg1{
    color: #0f0;
    background: #000;
    font-weight: bold;
}
.bg2{
    color: #00F;
    background: #FF0;
    font-weight: bold;
}
.bg3{
    color: #000;
    background: #eee;
    font-weight: bold;
}
</style>
<script type="text/javascript">
function c(s, i){
	return '<span class="bg' + i + '">' + s + '</span>';
}
var s = 'blabla <a href="http://jsfromhell.com">JSFromHell</a>';
document.write(s.highlight(["JS", "from", "o", "l"], c));
</script>