Hello again. Yet another weird problem. Can some kind soul show me the right approach?
I have a form in one frame, and links in a nav frame that allow the user to scroll to specific points within the form. These links are defined as hotspots within an image map in the nav frame. So far, thanks to help from experts in this forum, everything is cool with the navigation -- when you click on link #3 in the nav frame, the form in the other frame scrolls to section #3. When you click on link #5 in the nav frame, the form in the other frame scrolls to section #5. Perfect in every way.
NOW, however, management wants something new (of course).
The form also has a JavaScript in it (below) that places the focus within the first text field when the whole form document loads.
<script type="text/javascript" language="javascript">
<!-- Begin
function toForm() {
document.form_name.first_field_name.focus();
}
// End -->
</script>
<body onload="toForm()">
This is nifty, but management now wants to improve the form so that the same effect happens within each SECTION of the form -- when you click on link #2, for instance, the form is now supposed to scroll to section #2 AND place the focus on the first form field within that section. Same logic if the user then clicks on link #4, and so on.
Since the onclick event handler is already "occupied" with the code to scroll to the appropriate point in the form (see below), how can I get it to do something else at the same time?
<AREA SHAPE="poly" ALT="label" COORDS="144,11,254,11,270,27,130,27" HREF="body-frame.html#section-2" onMouseOver="rollover(2)" onMouseOut="original()" onClick="setCurrent(2);" target="body-frame">
(You can just ignore the references to the other JavaScript functions -- they're just simple rollover functions and they work fine.)
I've tried adding this:
document.form_name.second_field_name.focus();
after the current statement in the onclick, but here's the catch -- even if this would otherwise work, remember that the placing of the focus needs to take place in a different frame. Therefore, the reference to "document" (meaning the current document) won't work -- it's the wrong document. Can I reference the form document from within the nav frame? If so, how?
Lost and confused, as usual. Grateful for any suggestions, as usual.
John Herring
jhherring@yahoo.com
I have a form in one frame, and links in a nav frame that allow the user to scroll to specific points within the form. These links are defined as hotspots within an image map in the nav frame. So far, thanks to help from experts in this forum, everything is cool with the navigation -- when you click on link #3 in the nav frame, the form in the other frame scrolls to section #3. When you click on link #5 in the nav frame, the form in the other frame scrolls to section #5. Perfect in every way.
NOW, however, management wants something new (of course).
The form also has a JavaScript in it (below) that places the focus within the first text field when the whole form document loads.
<script type="text/javascript" language="javascript">
<!-- Begin
function toForm() {
document.form_name.first_field_name.focus();
}
// End -->
</script>
<body onload="toForm()">
This is nifty, but management now wants to improve the form so that the same effect happens within each SECTION of the form -- when you click on link #2, for instance, the form is now supposed to scroll to section #2 AND place the focus on the first form field within that section. Same logic if the user then clicks on link #4, and so on.
Since the onclick event handler is already "occupied" with the code to scroll to the appropriate point in the form (see below), how can I get it to do something else at the same time?
<AREA SHAPE="poly" ALT="label" COORDS="144,11,254,11,270,27,130,27" HREF="body-frame.html#section-2" onMouseOver="rollover(2)" onMouseOut="original()" onClick="setCurrent(2);" target="body-frame">
(You can just ignore the references to the other JavaScript functions -- they're just simple rollover functions and they work fine.)
I've tried adding this:
document.form_name.second_field_name.focus();
after the current statement in the onclick, but here's the catch -- even if this would otherwise work, remember that the placing of the focus needs to take place in a different frame. Therefore, the reference to "document" (meaning the current document) won't work -- it's the wrong document. Can I reference the form document from within the nav frame? If so, how?
Lost and confused, as usual. Grateful for any suggestions, as usual.
John Herring
jhherring@yahoo.com