471,896 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,896 software developers and data experts.

Redirect to another page with button click

how do I get a button to open another page - I have this

<button type="button">Buggy Whipp Bio</button>

i need it to bring a user to buggy whipp bio.html

Any help would be appreciated
Nov 18 '08 #1
12 213540
16,027 Expert Mod 8TB
If you want to avoid JavaScript, then use a submit button and set the action to the page you want to redirect to:
Expand|Select|Wrap|Line Numbers
  1. <input type="submit" value="Redirect">
Of course, you shouldn't be submitting a form to redirect, so use JavaScript, or a link.
Nov 19 '08 #2
Hey do this onclick="location.href='your_redirectionpage.html' " enjoy
Dec 1 '08 #3
16,027 Expert Mod 8TB
Yes, that would be the JavaScript method of redirecting to another page.

You can also use the button tag as a submit button by specifying type="submit".
Dec 1 '08 #4
yeah... but the submit buttom method wil have a posting and should have a form tag.. but this simple line of java script is worth while .. no extra fuss no posting.. jsut one click redirecting SIMPLE isn't it?
Dec 1 '08 #5
16,027 Expert Mod 8TB
Yes, I agree and if this had been posted in the JavaScript forum, that's exactly what I would have suggested.

If you want to avoid JavaScript, or have users who may have JavaScript disabled, then you're left with the option of a link or a submit button.
Dec 1 '08 #6
But Mr Decahedron is using <button> tag so the only option for redirection is onclick redirect... now he have to change the whole code to
<form action="somthing.html" >
<input type="submit" >


its a lot more tag and you changed the whole <button> tage to 2 tages extra.. and a posting which would be a burden for the server...

i dont think that there would be people who disable javascript... in this web 2 world.. where everything work on javascript and Ajax...
Dec 1 '08 #7
16,027 Expert Mod 8TB
That's not quite true. A lot of people for a number of reasons have JavaScript disabled or choose not to enable JavaScript, e.g. using the NoScript Firefox addon, or even do not support it. A web page should work without JavaScript and JavaScript should not be used for basic functionality on the page. JavaScript can be used to enhance the page for those who have enabled it. The exception is when you know your users, e.g. in an intranet or logged in staff in your company.
Dec 2 '08 #8
971 Expert 512MB
I am one who has the JavaScript disabled. It is interesting how many pages rely on it. Sometimes it is a hassle without it, but for the most part I like it better without JavaScript.

Dec 2 '08 #9
I accept your point "accorder" ... for security reason we may disable it in a intranet of an organization.

if Mr Decahedron don't have any trouble in using JavaScript then,let he use it... rather that a lot more posting and a form..

and Kevin u missed a beautiful web world without JavaScript
Dec 4 '08 #10
to redirect on another page you use
<button onclick="window.location.href='buggywhippbio.html' ">Buggy Whipp Bio</button>
Jul 5 '12 #11
you can use this code to redirect on another page:

<button onClick="window.location='page_name.html'" >click me</button>

i hope so it will help for you.
thank you,
Apr 2 '19 #12
83 64KB
try this code for redirect to another page
Expand|Select|Wrap|Line Numbers
  1. <button onclick="location.href = 'your Url';" id="myButton" class="float-left submit-button" >Buggy Whipp Bio</button>
May 23 '19 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by amit.purohit | last post: by
3 posts views Thread by Tom Nowak | last post: by
8 posts views Thread by Kees de Winter | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.