suu
01-20-2004, 11:36 AM
i've got a page with text, images and grids. i need to highlight words on the text that are on my DB (field TERMOS) and then onMouseOver show a little box with the description of that word (field DESC).
now, i've managed to highlight the words just fine, what i need is to know how i can show the box onMouseOVer the highlighted word.
i've got this piece of code which highlights the words just fine.
---------------------
function wordhighlight(aSourceObject, aWords, aDescrip){
regexp=/<[^<>]*>/ig;
vHTMLArray = aSourceObject.innerHTML.match(regexp);
vStrippedHTML = aSourceObject.innerHTML.replace(regexp,"$!$");
regexp= new RegExp ("(" + aWords + ")", "gi");
vTemp = vStrippedHTML.replace(regexp,'<span class="highlight">$1</span>');
for(i=0;vTemp.indexOf("$!$") > -1;i++){
vTemp = vTemp.replace("$!$", vHTMLArray[i]);
}
aSourceObject.innerHTML = vTemp;
}
----------------------------
aWords --> contains all the records on field TERMOS (records separated by |)
aDescrip --> contains all the records on field DESC (records separated by |)
how will i do the little box? how do i know that it will be the right description shown?
ideas please. i'm getting desperate!
now, i've managed to highlight the words just fine, what i need is to know how i can show the box onMouseOVer the highlighted word.
i've got this piece of code which highlights the words just fine.
---------------------
function wordhighlight(aSourceObject, aWords, aDescrip){
regexp=/<[^<>]*>/ig;
vHTMLArray = aSourceObject.innerHTML.match(regexp);
vStrippedHTML = aSourceObject.innerHTML.replace(regexp,"$!$");
regexp= new RegExp ("(" + aWords + ")", "gi");
vTemp = vStrippedHTML.replace(regexp,'<span class="highlight">$1</span>');
for(i=0;vTemp.indexOf("$!$") > -1;i++){
vTemp = vTemp.replace("$!$", vHTMLArray[i]);
}
aSourceObject.innerHTML = vTemp;
}
----------------------------
aWords --> contains all the records on field TERMOS (records separated by |)
aDescrip --> contains all the records on field DESC (records separated by |)
how will i do the little box? how do i know that it will be the right description shown?
ideas please. i'm getting desperate!