By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Cursor in Form

P: n/a
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);

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<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
Jul 23 '05 #2

P: n/a
Thanks that did exactly what I needed.

Chris

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.