PDA

View Full Version : help needed


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!

requestcode
01-20-2004, 01:21 PM
Maybe Tooltips? Check out this site for an excellent script:
http://www.bosrup.com/web/overlib/

suu
01-20-2004, 02:16 PM
it's something like this that i need. but how do i do this only linking to my DB?

like this:

<a href="javascript:void(0);" onmouseover="return overlib('This is an ordinary popup.');" onmouseout="return nd();">here</a>

it puts the code before word HERE. i need it to conect to my DB and automatically find the word HERE and on my tooltip put its description.