Jump to content

Find in page, highlight, scrollTo found string on iPhone


anmldr

Recommended Posts

I have been searching for a script that would find a string in a page, highlight the found string and scroll to the found string. I found a bookmarklet but it has a horrible interface. It has "file://(null)" above the "Find Text". Also, I need to delete remove the "Found X matches" dialog.Here is the code that I found

<p><strong><a href="java script:void%28s%3Dprompt%28%27Find%20text%3A%27%2C%27%27%29%29%3Bs%3D%27%28%27+s+%27%29%27%3Bx%3Dnew%20RegExp%28s%2C%27gi%27%29%3Brn%3DMath.floor%28Math.random%28%29*100%29%3Brid%3D%27z%27%20+%20rn%3Bb%20%3D%20document.body.innerHTML%3Bb%3Db.replace%28x%2C%27%3Cspan%20name%3D%27%20+%20rid%20+%20%27%20id%3D%27%20+%20rid%20+%20%27%20style%3D%5C%27color%3A%23000%3Bbackground-color%3Ayellow%3B%20font-weight%3Abold%3B%5C%27%3E%241%3C/span%3E%27%29%3Bvoid%28document.body.innerHTML%3Db%29%3Balert%28%27Found%20%27%20+%20document.getElementsByName%28rid%29.length%20+%20%27%20matches.%27%29%3Bwindow.scrollTo%280%2Cdocument.getElementsByName%28rid%29%5B0%5D.offsetTop%29%3B">Find in this page</a></strong></p>

The source of this is from http://www.lifeclever.com/17-powerful-book...or-your-iphone/The other problem with this if the found string is within a link, it seems to alter that link so that when you click on the link, there is a "Page Not Found" error.So, does anyone have another script that will find in the page, highlight the search term and scroll to the found string....and not alter a link if the found string is in a link?Thanks,Linda

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...