Niall Linden wrote:
is there any way to jump to an anchor on the page load. the thing is I
dont want to reload the page (as the page is being called by a submit
button on a form, so if i call the page again with an anchor tag i
loose all the form details)
someone said that to jump to an anchor with name anchorID you could
use
document.getElementbyID("anchorID").click();
but this method doesnt exist for anchor objects. is there another way
(that works) to do this. ive looked at the anchor object inthe
documentation but dont find any associated methods.
thanks
Niall
if (document.layers) {
// netscape 4 support
location.replace(location.href + '#anchorname');
} else {
location.hash = '#anchorname';
}
<a name="anchorname"></a>
Be aware, there are browsers other then Netscape 4 that support
document.layers, this solution works for me because I don't have to worry
about my userbase using those other browsers. Also, I've discovered some
odd behaviours with this and Opera 7.54. If I set location.hash twice in a
row to the same value, it reloads the page. I haven't tracked down if this
is a problem with my code, or a bug in Opera.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq