Currently, I am using a bit of javascript to highlight search word, but the user must first trigger onClick with a push of a button. I would like to start highlighting onKeyup or onChange of text box. Is there any easy way to do this? Be easy on me, I am a newbie.
Thanks, Marco site is here: http://makingmedicine.com/ff/ff.html /* credit for below two functions goes here: http://www.kryogenix.org/code/browser/searchhi/ */ function highlightWord(node,word) { if (node.hasChildNodes) { var hi_cn; for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) { highlightWord(node.childNodes[hi_cn],word); } } if (node.nodeType == 3) { tempNodeVal = node.nodeValue.toLowerCase(); tempWordVal = word.toLowerCase(); if (tempNodeVal.indexOf(tempWordVal)!= -1) { pn = node.parentNode; if (pn.className!= "searchword") { nv = node.nodeValue; ni = tempNodeVal.indexOf(tempWordVal); before = document.createTextNode(nv.substr(0,ni)); docWordVal = nv.substr(ni,word.length); after = document.createTextNode(nv.substr(ni+word.length)); hiwordtext = document.createTextNode(docWordVal); hiword = document.createElement("span"); hiword.className = "searchword"; hiword.appendChild(hiwordtext); pn.insertBefore(before,node); pn.insertBefore(hiword,node); pn.insertBefore(after,node); pn.removeChild(node); } } } } function googleSearchHighlight() { if (!document.createElement) return; highlightWord(document.getElementsByTagName("body")[0], exhibit.getComponent("textfct")._text); } -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en.
