+ 2

Help me to fix this is

World Search<br/> <input type="text" class="input" placeholder="name world"> <button type="button" href="link">Go</button> What must i do, if i want to make if the input box i fill "test.html" then i click the button "test.com/world/" will added in the url. result in new tab: test.com/world/test.html how ?

16th Jun 2020, 11:53 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
12 Antworten
+ 2
<html> <head> <title>Page Title</title> <base href="google.com/"> World Search<br/> </head> <body> <input type="text" class="input" placeholder="name world"> <a id="link"><button class="item_clicking" type="button">Go</button></a> <script> var f=document.querySelector(".input"); var g=document.querySelector("#link"); var k=document.querySelector(".item_clicking"); k.addEventListener("click",function(){ g.href=f.value; }); </script> </body> </html> and don't go for certificate ,it's not for showing someone instead understand the concepts , practice regularly!:-)
16th Jun 2020, 5:35 PM
Abhay
Abhay - avatar
+ 4
Add test.com/world/ to base tag inside head element <base href="test.com/world/"> now when test.html will be entered ,get the input value and on click of a button create "a" element and then append that input value to href attribute , And that button should be nested inside "a" tag you will create or get from Dom,so when you click on button you will be directed to that link
16th Jun 2020, 1:09 PM
Abhay
Abhay - avatar
+ 1
I think you should go through js course if you didn't understand at all what I said ,I clearly stated add base tag inside head tag , obviously you can't add input tag and button tag ,all those need to be displayed so add them in body tag ,I will provide you code for how you can do with js
16th Jun 2020, 3:11 PM
Abhay
Abhay - avatar
+ 1
add attribute target="_blank" in base tag
18th Jun 2020, 7:01 AM
Abhay
Abhay - avatar
+ 1
Abhay Not effect only open in newtab, how to make the result in other website? how to make href=linkfromme+valueinput if i click button (open in new tab) linkfromme.com/valueinput ?
18th Jun 2020, 9:05 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
+ 1
See base tag add the absolute link to whatever link you provided as input ,so if you want to provide a link from your own ,just remove base tag and instead provode the whole link or are you trying to take two inputs? Like some www.somesite.com and some keyword to search in that?
18th Jun 2020, 9:14 AM
Abhay
Abhay - avatar
0
Abhay how? <head> <base href="google.com/"> World Search<br/> <input type="text" class="input" placeholder="name world"> <button type="button">Go</button> </head>
16th Jun 2020, 2:28 PM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
done, i have the certificate but i forgot
16th Jun 2020, 3:28 PM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
Abhay How to make if i click Go the result will open in new tab then open other web your code result : myweb.com/input i want to make result : otherweb.com/input how ?
18th Jun 2020, 3:22 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
Abhay Yes how to make href=www.tes.com+inputvalue ?
18th Jun 2020, 9:16 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar
0
Why two input boxes tho?Why not let user enter the whole link? I don't get what you are trying to achieve by www.test.com+inputvalue since if www.test.com will be decided by user only then why not it can be just www.test.com/inputvalue
18th Jun 2020, 9:20 AM
Abhay
Abhay - avatar
0
Abhay I want to make www.test.com is hidden, can?
18th Jun 2020, 9:24 AM
Ahmad Sofiyurrohman
Ahmad Sofiyurrohman - avatar