<so**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
How would I get the focus command to work using the code below. I'm
trying to place the cursor in the stnum field when the user opens the
form. Thanks Chris
print $query->start_form;
print $query->textfield(
-name=>'-stnum',
-default=>'',
-size=>14);
print $query->textfield(
-name=>'~stnm',
-default=>'',
-size=>40);
Setting the focus to an input isn't a property of the input, it's a
method called (usually when the page loads):
<body onload="document.forms['yourForm'].elements['stnum'].focus();">
or
<head>
<script type="text/javascript">
window.onload = function()
{
document.forms['yourForm'].elements['stnum'].focus();
}
</script>
</head>
or endless variations of the two mechanisms above.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq