开发者

How to open another URL in a different window when a html page is loaded?

开发者 https://www.devze.com 2023-02-20 05:13 出处:网络
I have one html page, with a form on it. When the user posts the form, 开发者_高级运维I want the form receiving the response to automatically open up the URL passed by the post in a new browser window

I have one html page, with a form on it. When the user posts the form, 开发者_高级运维I want the form receiving the response to automatically open up the URL passed by the post in a new browser window.

Basically the URL is passed to the the other page, which in turn opens the URL in a new window then displays another form.

Thanks in advance.

Cheers

Shane


Add target="_blank" attribute to the <form>.

<form action="http://google.com/search" target="_blank">
    <input type="text" name="q" />
    <input type="submit" />
</form>

This will show the response in a new (blank) window. Note that this happens before the HTML page is loaded (it wouldn't make much sense otherwise).

0

精彩评论

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