My comment field is at the end of several paragraphs below the lower screen edge. Using 'onload' naturally moves the page up and the opening paragraphs are out of sight.
Any way to place the cursor in the field so the client does not have to click? Maybe after scrolling to a specified document place?
I am stymied. Any help? thanks a bunch, horst22
<script type="text/javascript">
// set focus to form field
document.forms[0].txtFullName.focus();
document.forms[0].txtFullName.select();
</script>
Where txtFullName is the name of the form field where the cursor will automatically be placed. That's of course, if I understand the question correctly.
Thanks a lot, but this 88 yr old beginner has a problem with 'name of form field'. II used the Textarea tag in the HEAD section as you can see. Here is my code:
<form method="post" name="commentform">
<FORM METHOD=POST ACTION="http://toolbox.omnis.com/bin/formmail.pl">
<form method="post" name="commentform">
<TEXTAREA NAME="request" ROWS="2" COLS="55"></TEXTAREA>
<input type=hidden name="recipient" value="horst@bookandpoems.com">
<input type="hidden" name="subject" value="A Confession">
<input type=submit value="send to Horst" name=submit>
<input type="hidden" name="return_link_url" value="http://shortstories.bookandpoems.com/index.HTML">
<input type="hidden" name="return_link_title" value="Back to the SHORT STORY MENU">
</FORM>
Thanks for your help, horst22
Place the reference to your text area right before your ending </form> tag:
Code:
<input type="hidden" name="return_link_title" value="Back to the SHORT STORY MENU">
<script type="text/javascript">
// set focus to form field
document.forms[0].request.focus();
document.forms[0].request.select();
</script>
</FORM>
Where request is the name that you've given to your text area.
Thanks Ryan. I appreciate the lesson.
It places the cursor where I wanted it but my main problem still remains and I have a hunch that it cannot be solved. The document text is more than one screen full. The comment field is at the end of the text. The cursor, naturally, moves the text up so that the visitor looks at the end instead of the start.
Is there a way to either prevent that behavior, - or start the script after the visitor reaches the end of the document? I promise - no further question. Mahalo - thanks.
Bookmarks