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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jump to the middle of the page

Status
Not open for further replies.

revit

Programmer
Oct 27, 2001
36
0
0
IL
I need that when someone enters my page he will enter directly to the middle of it (or some marked place) like #top but from another page. Thanks
 
mark the place in your page with a tag like this:
Code:
<A NAME=tagname></A>
you can then link to that position with:
Code:
<A HREF=&quot;yourpage.htm#tagname&quot;>your link</A>
Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
Hi
Try something like

<BODY onLoad=&quot;location.replace('thisPage.html#top')&quot;>

or

<BODY onLoad=&quot;location.href='thisPage.html#top'&quot;>

The difference between these methods is that setting href will generate a new entry in the History object, but replace() will not.
 
here's a cool example I've used in the past from

first.htm
<HTML>
<HEAD>
<TITLE>Links and Anchors: Window 1</TITLE>
</HEAD>
<BODY>
<SCRIPT>
window2=open(&quot;second.htm&quot;,&quot;secondLinkWindow&quot;,&quot;scrollbars=yes,width=250, height=400&quot;);
function linkToWindow(num) {
if (window2.document.anchors.length > num)
window2.location.hash=num;

else

alert(&quot;Anchor does not exist!&quot;);
}
</SCRIPT>
<B>Links and Anchors</B>
<FORM>
<P>Click a button to display that anchor in window #2
<P>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;0&quot; NAME=&quot;link0_button&quot; onClick=&quot;linkToWindow(this.value)&quot;>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;1&quot; NAME=&quot;link0_button&quot; onClick=&quot;linkToWindow(this.value)&quot;>

<INPUT TYPE=&quot;button&quot; VALUE=&quot;2&quot; NAME=&quot;link0_button&quot; onClick=&quot;linkToWindow(this.value)&quot;>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;3&quot; NAME=&quot;link0_button&quot; onClick=&quot;linkToWindow(this.value)&quot;>
<INPUT TYPE=&quot;button&quot; VALUE=&quot;4&quot; NAME=&quot;link0_button&quot; onClick=&quot;linkToWindow(this.value)&quot;>
</FORM></BODY></HTML>

second.htm
<HTML>
<BODY>
<A NAME=&quot;0&quot;><B>Some numbers</B> (Anchor 0)</A>
<UL>
<LI>one
<LI>two
<LI>three
<LI>four
</UL>
<P><A NAME=&quot;1&quot;>
<B>Some colors</B> (Anchor 1)</A>
<UL>
<LI>red
<LI>orange
<LI>yellow
<LI>green
</UL>
<P><A NAME=&quot;2&quot;><B>Some music types</B> (Anchor 2)</A>
<UL>
<LI>R&B
<LI>Jazz
<LI>Soul
<LI>Reggae
<LI>Rock
</UL><P><A NAME=&quot;3&quot;><B>Some countries</B> (Anchor 3)</A>
<UL>
<LI>Afghanistan
<LI>Brazil
<LI>Canada
<LI>Finland
<LI>India
</UL>
</BODY>
</HTML>

I help at your own risk, if I brake it sorry! But if I fixed it, let me know.[thumbsup2]
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top