Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q594 Is there a way to unconditionally direct the browser to an anchor tag?

You are here: irt.org | FAQ | JavaScript | Link | Q594 [ previous next ]

Try:

<html>

<head>
<script language="JavaScript"><!--
function relocate(hash) {
    if (location.hash != hash) {
        if (document.images)
            location.replace('http://www.somewhere.com/page.htm#' + hash);
        else
            location.href = 'http://www.somewhere.com/page.htm#' + hash;
    }
}
//--></script>

</head>

<body onLoad="relocate('myAnchor')">

....

<a name="myAnchor"></a>

</body>
</html>

Feedback on 'Q594 Is there a way to unconditionally direct the browser to an anchor tag?'

©2018 Martin Webb