Setting the cursor on a form field

M

Merlin

Hi there,

I would like to set the cursor upon loading a page on a text field which has
already been populated.

The problem with this code:

<script language="JavaScript1.1" type="text/javascript">
<!--
document.send_mail.message.focus();
-->
</script>

is that the cursor is on the bottom of the already included text. Has anybody an
idea on how to set the cursor on postion one of the field?

Thanx for any help,

Merlin
 
M

Michael Winter

[snip]

The first note: please don't use tabs to indent code. Instead, use spaces,
preferably two.
<script language="JavaScript1.1" type="text/javascript">

At best, specifying a version using the language attribute is pointless.
At worst, it's harmful. Furthermore, the language attribute has been
deprecated for six years. Just use the (required) type attribute.

Hiding scripts is also an obsolete practice.
document.send_mail.message.focus();
[snip]

Has anybody an idea on how to set the cursor on postion one of the field?

Not with any reliability. Anyway, can't your users use the Home key?

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top