[thelist] Setting focus+

Timothy Martens timfm at hawaii.rr.com
Fri May 10 17:07:01 CDT 2002


How can I set the cursor position to the END of an input field which
already has a value? I guess I need to get the length of the value and
then place the cursor after that - just not sure how. Here's the basic
block which sets focus to the beginning of the field...

<body onload="setFocus();">
<script language="JavaScript" type="text/javascript">
function setFocus() {
  document.myForm.URL.focus();
  }
</script>

<form name="myForm">
  <input name="URL" size="40" value="http://" />
</form>
</body>

Mahalo (thanks),

 t.




More information about the thelist mailing list