+ 1

How to Make this is?

Ilustration : [inputtext] [button] i fill in inputtext be (test.html) [test.html] [button] then i click the button to open the link/new tab result : www.testing/tester/test.html

16th Jun 2020, 10:15 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
10 Answers
+ 1
Do you want the link to open in new tab? In that case, add target="_blank" to your a tag.
16th Jun 2020, 11:09 AM
Sajid
Sajid - avatar
+ 1
Mr ASR what do you want then? Be a bit more clear.
16th Jun 2020, 11:33 AM
Sajid
Sajid - avatar
0
no
16th Jun 2020, 11:31 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
if i fill in inputtext "test.html" then i click the button result in new tab : www.testung/tester/test.html how?
16th Jun 2020, 11:35 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
Mr ASR hi, It depends on how you set your button. If you just have that element , then you can add an EventListener in js or a onclick attribute in the tag with a function set in js. You can also nest a a tag inside your button and use target attribute as said by Sajid before. Or use input of type submit instead of button and nest your inputs inside a form . * <button onclick="myTest()">Test</button> // Set a myTest() function in js to handle the button pressed. * <button><a href="your link here" target="_blank">Test</a></button> *<form action="your link" method="post"> <input type="text" name="test" > <input type="submit" value="test button""> </form> //The submit will be handled on the serverside. If you program on sololearn, the simplest would be the nested a tag. Your test.html would be another bite of code. You copy paste the link to it as your href in the a tag.
16th Jun 2020, 12:32 PM
EmmanueLZ.
EmmanueLZ. - avatar
0
what i must add in the javascript? EmmanueLZ.
16th Jun 2020, 12:41 PM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
You'll find some ways to achieve what you want in this link. https://www.developintelligence.com/blog/2016/04/javascript-redirect-how-to-redirect-a-web-page-with-javascript/#:~:text=window.,to%20in%20the%20above%20code. Try by yourself, and if you're still stuck, post your try, so we check how to resolve it. Don't forget, if your input contain part of the link , you'll have to get that value first, than treat in in a way it will be included in the full path of the URL, and then do the stuff to redirect. Hope it will help, good luck.
16th Jun 2020, 2:59 PM
EmmanueLZ.
EmmanueLZ. - avatar
0
And this link gives a more precise exemple for your case : https://www.geeksforgeeks.org/javascript-redirect-a-url/amp/
16th Jun 2020, 3:07 PM
EmmanueLZ.
EmmanueLZ. - avatar
0
thanks bro for help
16th Jun 2020, 3:29 PM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
Is target=_blank only avaliable for computer?
17th Jun 2020, 3:35 PM
Sali65
Sali65 - avatar