hello
I use a php script to find a word in a text and to display the text with the word highlighted. If the word is at the end of the text an the text is very long, the user must use the vertical scroll bar to see the word
how can I do this automatically? (the highlighted word should be at the middle of the screen)
thank you for your help?
for something like this i would look into a javascript solution, since this seems to be a client side issue, not a server side issue as PHP would be
you could actually make the text that you want to highlighta text box - and have an onload shift focus to that text area. Just use style sheets so the text area matches your page 🙂
I'd say create an anchor for every 10 or so lines, and then jump to the anchor containing the line number set: floor(($num/10)) = closest set of 10
To set the anchor: <a name="10"></a>
To go to the anchor: <a href="page.php#10">Go to line 10</a>
Thank you guys the answer of mystrymaster seems to be the easyest but I don't understood very much can you explain more please.
thanks again
use style sheets to change the border and background color of the text box and name them.
the in the body take call a javascript function that will shift focus to the named text area.