Email conversation
From | Andrew Watson |
To | Me |
Subject | Find-in-page cursor position question |
Date | 8 February 2006 23:44 |
Hi,
I have found your Find-in-page script very helpful and was wondering if you
could advise me of an easy way to set the cursor to be active in the text
box when the page loads. And if I am not pushing my luck, is there a way to
clear the text box and keep the active cursor there once the button is
clicked (ready for the next lookup)?
Please keep in mind I am not a fluent programmer….
Thanks
Andrew
From | Me |
To | Andrew Watson |
Subject | Re: Find-in-page cursor position question |
Date | 9 February 2006 15:55 |
Andrew,
> I have found your Find-in-page script very helpful and was wondering
> if you could advise me of an easy way to set the cursor to be active
> in the text box when the page loads.
Just a small addition to the script where you create the search field:
if( ( document.body && document.body.createTextRange )|| window.find ) {
...document.write the form here...
document.forms[document.forms.length].elements[0].focus();
}
> is there a way to clear the text box and keep the active cursor
> there once the button is clicked (ready for the next lookup)?
No. If you focus the input after performing a search, then it will remove
the highlight from the text on the page (basically meaning that it will look
like it didn't find anything).
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Andrew Watson |
To | Me |
Subject | Re: Find-in-page cursor position question |
Date | 10 February 2006 13:28 |
Attachment | Demo page |
Thank you for the fast response,
I am sure that I am missing something here, just not sure what. I have
attached my code below. Would it be possible for you to tell what I am
missing. After I inserted the small addition to the Find in Pare script,
everything sill seem to work correctly, I just could figure out how to tell
the script that I wanted the focus to be in the Find box.
Thanks again...
From | Me |
To | Andrew Watson |
Subject | Re: Find-in-page cursor position question |
Date | 10 February 2006 15:28 |
Andrew,
> I am sure that I am missing something here, just not sure what.
no, sorry, it was my fault. the line should have been
document.forms[document.forms.length-1].elements[0].focus();
From | Andrew Watson |
To | Me |
Subject | Re: Find-in-page cursor position question |
Date | 13 February 2006 12:13 |
Worked great...
Thank You