Click to See Complete Forum and Search --> : Nav Button for Somewhere Else on Same Page


BSquared18
01-15-2003, 10:12 AM
Hi,

I use the code below for buttons that send the user to another page:

<BUTTON STYLE="background-color: #FFFF00;" onClick="window.location='index.html'"><font color="#000000"
size="3"><strong>Home</font></strong></BUTTON>

How would I modify this code to use the button to send the user to somewhere else on the SAME page? What would be the code for the target the user is being sent to?

Thanks!

Bill B.

khalidali63
01-15-2003, 10:19 AM
You need to do this to get the required functionality

declare a location where you want to go when you click on an internal link

<a name="internal_a1">First inernal Link</a>

and then in the button


if this does not work for some strange easons then you can append the currentpages url befre #
such as
"window.location='currentPage.html#internal_a1'"

Hope this helps

cheers

Khalid

BSquared18
01-15-2003, 10:36 AM
Khalid,

Based on your suggestion, this is what I tried:

<form>
<BUTTON STYLE="background-color: #FFFF00;"onClick="window.location='currentPage.html#internal_a1'"> <font color="#000000"
size="3"><strong>Title Here</font></strong></BUTTON>
</form>

And then, further down the page:

To here <a name="internal_a1">

But when I clicked on the button, I got a blank screen. Any suggestions?

Bill B.

khalidali63
01-15-2003, 10:41 AM
Did you change the currentPage.html to the page name where all of your code ?

Khalid

BSquared18
01-15-2003, 10:47 AM
NO. I thought "currentPage" was a JavaScript function that would know what the current page was. When I replaced it with the page name, it worked fine. Thanks for the help!

Bill B.