PDA

View Full Version : Use Button clickevent as hyperlink?


Richard Diedrick
09-19-2010, 05:44 PM
I have been trying to attach a hyperlink to another page in my site using a form button. Have tried different approaches but no success. I would think this would be a common use for a button? Help.Thanks

Corrosive
09-19-2010, 06:09 PM
I would think this would be a common use for a button?

Really? I wouldn't have said so. List items are best for menus and you'd normally use scripting to redirect a user to another page after a form is processed. As in the action of the form hits the PHP processing page and the end of the PHP code gives a redirect if required. Like a 'thank you' page after a contact form is submitted.

That said, have you tried using an onclick handler like...

onClick="location.href='newpage.html'"

as part of your button code?

gentleone
09-19-2010, 06:09 PM
Do you mean something like this?
<input type="button" value="home page" onclick="window.location.href='http://www.domain.com'">

Richard Diedrick
09-19-2010, 09:59 PM
Guess I am more used to VB & C++ where links are a common use of buttons. Will try the code. Thanks