HTML - form tag bringing you to a website


HTML - form tag bringing you to a website



How would you do this with form ()?



Make a text box and a Submit button.
You type anything in the textbox and Submit will open a website in your browser with a link of: (example) test.com/TextTheyPutHere.
Basically, if I put 'lol' in the textbox, it would open a website test.com/lol.



Please help.




1 Answer
1



Try this:


<!DOCTYPE html>

<html>
<head>
<script>
function newDoc() {
window.location.assign("http://www.yourVeryOwnSitez.com/"+document.myForm.myDestination.value)
}
</script>
</head>

<body>
<form method="post" name="myForm">
<input type="text" name="myDestination">
<input type="button" value="Gogogo" onclick="newDoc()">
</form>
</body>
</html>



Then edit line 7 and put your particular url in the place of "www.yourVeryOwnSitez.com".





Thanks this helped. Found out you need Javascript for that now. Also I'm new to stackoverflow so I'm not sure if I marked the answer as correct, the tick on the left of your comment is green so I think I did it right. Thanks anyway!
– MdsCool
Apr 5 '16 at 16:59






That's it. Many thanks!. Keep it up man.
– statosdotcom
Apr 5 '16 at 17:00






One question, any way to make the text box bigger?
– MdsCool
Apr 5 '16 at 17:17





Ahah yes... some options. If you just want to have a wider textbox just play with "size" property. So, try this on your code: <input type="text" name="myDestination" size="80">. But I recommend you test in various browsers and platforms, cause the same value can cause different results. if you want different fonts, colors, sizes inside textbox then maybe better google for it. There are many options, all of them based on CSS. Luck.
– statosdotcom
Apr 5 '16 at 17:26


<input type="text" name="myDestination" size="80">





Ok, thanks man, the help is appreciated. :)
– MdsCool
Apr 5 '16 at 17:38






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

List of Kim Possible characters

Audio Livestreaming with Python & Flask

NSwag: Generate C# Client from multiple Versions of an API