Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Highlighting Text in a Web Page
#5
Getting closer....
I found a bookmarklet that highlights text in IE on this website:

http://subsimple.com/bookmarklets/import_ie.htm
Code:
Copy      Help
javascript:function H(w,s){r=w.document.body.createTextRange();for(i=0;r.findText(s);i++){r.execCommand('BackColor','','yellow');r.collapse(false);}return i;}function G(){if(frames.length==0)return document.selection.createRange().text;else for(k=0;F=frames[k];++k){u=F.document.selection.createRange().text;if(u)return u;}}function P(){var t=0,s=G();if(!s)s=prompt('Find:','');if(s){if(frames.length==0)t+=H(window,s);else for(j=0;F=frames[j];++j)t+=H(F,s);alert(t+' found.');}}P();

I tried to incorporate it into Toolbar with Web Browser using the example from the Resources Archive

Macro
Code:
Copy      Help
str jshilite = "javascript:function H(w,s){r=w.document.body.createTextRange();for(i=0;r.findText(s);i++){r.execCommand('BackColor','','yellow');r.collapse(false);}return i;}function G(){if(frames.length==0)return document.selection.createRange().text;else for(k=0;F=frames[k];++k){u=F.document.selection.createRange().text;if(u)return u;}}function P(){var t=0,s=G();if(!s)s=prompt('Find:','');if(s){if(frames.length==0)t+=H(window,s);else for(j=0;F=frames[j];++j)t+=H(F,s);alert(t+' found.');}}P();"

int hwnd =  win("TOOLBAR WITH WEB BROWSER" "QM_toolbar")


;int hDlg
web jshilite 0 hwnd

I hear the clicking of a web page loading but don't see any search dialog. Any have any idea what I may be doing wrong?

Thanks,
Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)