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

button link

Status
Not open for further replies.

playerx

Technical User
Joined
Feb 23, 2006
Messages
10
Location
US
I have two buttons and each button goes to a different page when clicked

question or problem.

I don't want to use the form action to go to another page.

I want to use the onclick fuction in the button properties

how can I do this

does any one hav
e a sample
 
Try:
Code:
<input type="button" onclick="location.href='newpage1.htm'" value="Click Me 1"> <input type="button" onclick="location.href='newpage2.htm'" value="Click Me 2">

Lee
 
can i suggest styling anchor tags to look like buttons? Lee's solution, while perfectly acceptable, will not work when javascript is disabled.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
You could have a form on the page (formA) that contains just the button to pageA. Same thing with the button that takes you to pageB - it has it's own form called formB.

Now you can use method="get" and use the action of each form to do the navigation. The main page form doesn't get affected by this at all (so you can use the action in that for as normal).

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Any luck with this one, playerx? If you found the posts useful, let those that attempted to help you (using their own time and resources for free) know your appreciation.

It would also be nice if you could summarize the solution that worked for you and post it as a followup (for the next person researching the same problem).

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top