Can a local page accept text value and open new tab at Internet URL with value as parameter?

StackOverflow https://stackoverflow.com/questions/11462318

  •  20-06-2021
  •  | 
  •  

문제

An Internet site has URL like www.manyresultpages.net/cgi-bin/search.cgi?recnum=7777&

Can I make my Dad a local static html page (for his PC) with one input field and a submit button, that will modify the above URL, replace "7777" with the input text and open the new URL in a new tab on button click?

I'm HTML-challenged, googled for 45 mins without getting far. Did learn jsfiddle.net is down. Can load jQuery if that would help.

도움이 되었습니까?

해결책

Yes. Use method="get" in the form to place the form data in the URL, use an input field with name="recnum" to get the right name for the form data, and use target="_blank" in the form to open the page in a new window/tab:

<form method="get" target="_blank">
  <input type="text" name="recnum"/>
  <input type="submit"/>
</form>

Note that you can't control whether the page is opened in a new window or a new tab, as that is a user preference in the browser.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top