CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Navigation (hyper links) inside a webpage...? (http://www.codingforums.com/showthread.php?t=192491)

Student23 03-27-2010 01:36 PM

Navigation (hyper links) inside a webpage...?
 
Hi,

I'm working on a webpage which has a lot of information packed into it...

I wanted to create a simple navigation inside the website, for example;


.................................

This section deals with;

Q1 (click to go to this section)
Q2 (click to go to this section)

......

Heading: Q1

bla bla bla

(click here to go back to top of the page)

.....

Heading: Q2

bla bla bla

(click here to go back to top of the page)


(click here to go back to the top of the page)
..........................

I have seen some javascript codes which are just unbelievable complicated and advanced, how can I do this with the simplest of codes?


I appreciate your time,
Thanks!

Philip M 03-27-2010 04:02 PM

This has nothing to do with Javascript.

Code:

<a name="pagetop"></a>

<a href="#pagetop">Click here to return to the top of this page</a>


To navigate to a different page:-

Code:

<a href = "mypage2.html">Go To Page 2</a>

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

Student23 04-08-2010 04:57 PM

I tried to use the above mentioned technique with a button;

Quote:

<form>

<input type="button" value="Go to Top of the Page" onClick="<a href="#pagetop"></a>">

</form>

&

<form>

<input type="button" value="Go to Top of the Page" onClick="#pagetop">

</form>
I tried a number of different ways but none of them work...

adamck 04-08-2010 05:00 PM

these should work if you have names the top section of the page.
at the top of the page put:
Code:

<a name="pagetop"></a>
Further Down the page (enough to create a scrollbar) put:
Code:

<a href="#pagetop">Click here to return to the top of this page</a>

Student23 04-08-2010 05:17 PM

Quote:

Originally Posted by adamck (Post 941993)
these should work if you have names the top section of the page.
at the top of the page put:
Code:

<a name="pagetop"></a>
Further Down the page (enough to create a scrollbar) put:
Code:

<a href="#pagetop">Click here to return to the top of this page</a>

That works fine, but i'm trying to incorporate the above method in a button.

Thanks for your reply.

Philip M 04-08-2010 05:22 PM

As this is an anchor link you cannot use a button, but you can use an image:-

<p align="center"><a href="#pagetop"><img src="topPage.gif" width="54" height="29" border="0"></a></p>

and at the top of the page put

<a name="pagetop"></a>

If you insist on a button you can make an image which looks just like a button. :)

You can use a button to link to another page:-

Code:

<form>
<input type ="button" value = "Go to Google" onClick="parent.location='http://www.google.com'">
<form>


Student23 04-08-2010 06:19 PM

Quote:

Originally Posted by Philip M (Post 942003)
As this is an anchor link you cannot use a button, but you can use an image:-

<p align="center"><a href="#pagetop"><img src="topPage.gif" width="54" height="29" border="0"></a></p>

and at the top of the page put

<a name="pagetop"></a>

If you insist on a button you can make an image which looks just like a button. :)

You can use a button to link to another page:-

Code:

<form>
<input type ="button" value = "Go to Google" onClick="parent.location='http://www.google.com'">
<form>


What about linking to the same page instead of another page?

Quote:


<form>

<input type="button" value="Go to Top of the Page" onClick="parent.location='home1.htm'">

</form>
It works perfectly fine now! :)

Philip M 04-08-2010 06:24 PM

Well that amounts to refreshing the page. Not exactly the same thing as moving to an anchor at the top of the page.


All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.