473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Redirect to another page with button click

Decahedron
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 214510
acoder
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
clain
79
Hey do this onclick="location.href='your_redirectionpage.html' " enjoy
Dec 1 '08 #3
acoder
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
clain
79
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
acoder
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
clain
79
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" >
</form>

??

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
acoder
16,027 Expert Mod 8TB
@clain
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
eWish
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.

--Kevin
Dec 2 '08 #9
clain
79
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
AjayGohil
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: amit.purohit | last post by:
hi, I have a very strange problem on my login Page. the Page was working fine a few days back, but now does not generate post back events for controls. this login page uses form based...
3
by: Tom Nowak | last post by:
I have written a web app that includes a login page. When a user successfully logs in, they are taken to the main web app page. I have a button on this page that I want to use to redirect the...
4
by: COHENMARVIN | last post by:
I'm a asp programmer starting out with asp.net. I understand that an asp form can post to its own page and that this allows validation of form fields on the server. But suppose all the controls...
8
by: Kees de Winter | last post by:
Hi, On a form I have several submit-buttons, each of which should post its own set of variables (e.g. price and name of a product) to another page, e.g. an orderpage. There can only be one form,...
2
by: hellboss | last post by:
HI ! I am workin wit asp.net vs 05 , I have some document file in my local directory and its corresponding path and its file name is strored in a the database table. In the Page 1, i have listed...
2
by: namrataa | last post by:
Hi, I am working on mediaplayer using mediaelement in WPF usin VS2008 using C#. In my mediaplayer I have two tabs one is "Now Playing" and another is "guide". The "guide" tab is focused.The...
1
by: zizi2 | last post by:
I have a form that I want to redirect to another page after clicking the submit button. It works well (please see the code below) except that it cancells my pop-up message, it goes the redirected...
1
by: digituf | last post by:
can someone help me by telling me why is that whenever i click the javascript calendar, it redirect me to another page eventhough i still do not finish fill the form? here is the code: ...
0
by: Anupam Jana | last post by:
Hello All, I want to redirect to some other directory page after displaying JavaScript alert message in ASP.net in a page. For that I tried bellow code in our application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.