Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using anchors with form data

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
US
This may be such a basic problem with a very simple solution, BUT I can't come up with it. I have a data entry form. On processing of a button with the value "Next" I want to reload the same page, load the next picture in the gallery, give focus to the "next" button, and transfer to an anchor that's located right where the form is.

Code:
<form name="getdata" method="post" action="showGallery.asp#page_top">
<a name="page_top"></a>


Also: <BODY onLoad="document.getdata.next.focus ();">

The problem is: Transfer is made to the anchor, but the "next" button doesn't get the focus.

Shouldn't the onLoad event occur when you are loading a page and transferring to an anchor?

Thanks in advance,

Jerry Scannell
 
By transfer I mean that after the page is loaded the screen moves/scrolls to the location where the anchor is.


Jerry Scannell
 
Hi

Got it. Well, that works for me as expected in FireFox. Is it possible that your expectations are different ?

Anyway, for more on this would be better to know something more about the placement of the [tt]form[/tt] and the anchor on the document.

Feherke.
 
What additional information do you need? I will provide it.

Don't forget that the problem isn't the transfer to the anchor --- it's the processing of the onLoad event that isn't happening.


Jerry Scannell
 
The problem is that the onLoad event doesn't even execute. I've debugged this by actually creating a function called selectNext() which does the document.getdata.next.focus () as well as generate an alert().

It doesn't happen.

So the problem is centered squarely on the onLoad event not executing...

Jerry Scannell
 
The normal onLoad event is the document.getdata.next.focus ();

I added the function selectNext() for testing purposes only.

While there are other scripts on the page, nothing else could be construed as an onLoad event.

There is something about executing an onLoad=xxx when the page URL contains a #anchor-name directive.

You said earlier that something you tested worked in Firefox. What exactly did you test: The anchoring or an onLoad event?


Jerry Scannell
 
Hi

Jerry said:
You said earlier that something you tested worked in Firefox. What exactly did you test: The anchoring or an onLoad event?
Both. In combination with a big image to force scrolling. I mean, I tried the possible permutations to see where the page scrolls and the focus jumps. Additionally I also moved and/or delayed the JavaScript code.

Could you give us an URL to publicly available copy of that page ?

Feherke.
 
Wow. This is strange. Up until now I had been running this code on my computer since it was new code. I just copied the code up onto the website for you to try it, and it works up there!

So it must be something about my version of IIS. That's a puzzling one...

It looks like there isn't a problem after all. Thanks for your help.

jerry

Jerry Scannell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top