lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
JS: field focus revisited
A simple javascript function for setting focus to field of your choice. It requires knowing form name and field name:

<script type="text/javascript">
function focus_field(form_name, field_name)
{
document.form_name.field_name.focus();
document.form_name.field_name.selectionStart=0;
document.form_name.field_name.selectionEnd=0;
}
</script>


Then in body tag:

<body onload="focus_field(form_name, field_name)">


reference: houseoffusion.com