How do I move the focus inside a Php generated page?

Hi,

How does one move the focus within a Web page, to various DIV elements of that page, which Web page is of course generated by Php?

So for example if user types A and clicks Submit, I want in the resulting page generated as a result of their POST for them to be at the element on the Web page designated by <div id =“a_elem”>

And if I need to use another idea to achieve the focus result, please advise that. But please keep in mind that the simple <a name=“a_elem”></a> since this is a POST generated page.

ThanX,

Look at this example:

<html>
<script language="javascript">
function MovePage()
{
	alert('moving page');
	//location.replace=document.location.href+"#footer";
	document.location.href=document.location.href+"#footer";
}
</script>
<body onLoad="MovePage();">
Top of page
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr><hr>
<a name="footer">
Bottom of page

</body>
</html>

When this page is loaded it moves to the location of the footer. Assuming this was the post page you could accept the name of the location as a post variable and then plug it in to the function so that when the page loads it goes to the spot you want. I only tested this in IE so it might need tweaking for other browsers.

From the calling page you would need to pass the location that you want to move to in the target post page.

I’m not certain you can move to a specific DIV position…I would have to research that.

Hopefully this will get you going in the right direction.

ThanX. This suggestion works fine.