How do you get the button to take you to a different page? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 11

How do you get the button to take you to a different page?

I have created the button but I don't know how to make it go onto a different page.

30th Dec 2021, 9:41 AM
Rhia
18 ответов
+ 3
Can you add an image - I am new to this and am not sure what that means
30th Dec 2021, 10:04 AM
Rhia
+ 3
Jayakrishna can you simplify that, I am only on level 2 or 3 (I haven't checked recently).
30th Dec 2021, 10:10 AM
Rhia
+ 3
Who still uses jQuery?
31st Dec 2021, 8:55 PM
Sonic
Sonic - avatar
+ 2
Ok, so how do I do it, PyNon?
30th Dec 2021, 10:46 AM
Rhia
+ 2
Thanks Solomoni Railoa. Sorry o didn't reply sooner - I was playing Solitaire
30th Dec 2021, 12:28 PM
Rhia
+ 1
Ex: Use target attribute value as _blank or _top <button onclick="nw()" target="_top"> Martial Arts </button> <scrip> function nw(){ document.write("added image") ; ;} </scrip> change scrip to script tag edit: Rhia add this above code in your html body tag.. and see a button has added target property and on click, it calls nw() function which creates a image and a output or what ever you add..
30th Dec 2021, 10:04 AM
Jayakrishna 🇮🇳
+ 1
I always seem to mess it up though. 😅
30th Dec 2021, 12:39 PM
Rhia
+ 1
<button onclick="window.location='./path or example.com';">click here</button> Rhia I think this one is the easiest way to implement button with link. because if we use <a href="#"> in the button, sometimes underline will added automatically in the button text.
31st Dec 2021, 3:29 AM
sanjib mondal
sanjib mondal - avatar
+ 1
jQuery is your best friend.
31st Dec 2021, 4:57 PM
Vlagyimir
Vlagyimir - avatar
+ 1
<a href="you page link here"><button>type the info here</button></a> I hope this helps
1st Jan 2022, 1:44 AM
Ikhayere Humphrey
+ 1
<!-- This is an example of a "button", it's a link element but styled, don't need scripts, only html and css: --> <DOCTYPE html> <html> <head> <style> a { color: white; background-color: #337; border-radius: 5px; padding: 10px; } </style> </head> <body> <a href"https://www.google.com">Go to Google</a> </body> </html>
1st Jan 2022, 8:05 AM
Xzeroabs
Xzeroabs - avatar
0
<!DOCTYPE html> <html> <head> <title>Shamanozii</title> </head> <body> <button onclick="nw()" target="_top"> Click on </button> <sct> function nw(){ document.write("New Html file"); }; </sct> //modify this to script tag and check </body> </html> edit: check this above code by modifying <sct> tag to script tag and see.. is that what you trying? Rhia
30th Dec 2021, 11:25 AM
Jayakrishna 🇮🇳
0
Use button, anchor tag and target a blank page. If I'm not mistaken. <button><a href="youPagehere">More info</a><button>
31st Dec 2021, 1:55 PM
Sam
0
<button><a href="your Page" target="blank_">More info</a></button>
31st Dec 2021, 1:59 PM
Sam
0
Sorry it's not my subject 😅
31st Dec 2021, 7:13 PM
RTB
RTB - avatar
0
Use a hyperlink
1st Jan 2022, 2:24 AM
chidubem ndukwe
chidubem ndukwe - avatar
0
Make a button with span or other elements inner one <a> tag . Then in href attribute of a put your target link .
1st Jan 2022, 6:57 AM
AmirrezzaFreydouni
AmirrezzaFreydouni - avatar
0
ok
1st Jan 2022, 7:05 AM
vikash Gupta