开发者

Sending HTML form to address bar

开发者 https://www.devze.com 2023-02-07 06:38 出处:网络
Is it possi开发者_JS百科ble to generate a form in html that allows the text that\'s input to be sent to the address bar?Sure is, you just make sure the forms METHOD is set to GET:

Is it possi开发者_JS百科ble to generate a form in html that allows the text that's input to be sent to the address bar?


Sure is, you just make sure the forms METHOD is set to GET:

<form id="myForm" method="GET">
//Form Stuff
</form>

Take a look here for more information


Without any testing and going off the top of my head, this should do the trick (messily):

<form onsubmit="window.location = document.getElementById('addressfield').value; return false;">
   <input type="text" id="addressfield" />
</form>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号