Domanda

i am currently making a static webpage this page will have a lot of text and i want the users to have the ability of searching exactly as they would do with the find feature of a browser(ctrl+f) i found a couple of javascript files that could open a window and search but it's not what i am looking for, i want something that will search and highlight as fast and easy as browsers do so because i can't find something like this, i want to put just a button that by being clicked it will enable the find feature just as it would by pressing ctrl+f it's hard i know but help me please

edit: i had find these too but you have to click to search

http://javascript.about.com/library/blufind.htm?

http://www.seabreezecomputers.com/tips/find.htm

È stato utile?

Soluzione

As other users have already pointed out, what you are trying to acheive will not work - at least not as expected and definitely not cross browser. It's also good to search before posting here. I found several links, however ultimately settled on a year old post on this website.

Ultimately, you cannot sendkeys at this level so either you need to create something similar to some of the links suggested by other users in the linked thread, or as @michaelb958 suggested, have the user manually hit Ctrl+F.

Use Browser Search (Ctrl+F) through a button in website?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top