如何在新窗口中打开 JavaScript 搜索引擎(使用“function Jump() {”)?
看到这个 http://javascript.internet.com/forms/multiple-search-引擎.html 。我想知道如何在新窗口中打开搜索结果。帮我!
see this http://javascript.internet.com/forms/multiple-search-engine.html . i wonder how to open the search result in new window. help me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1) 不要这样做
2) 真的不要这样做
3) 如果您必须这样做,请将函数绑定到“搜索”按钮的 onclick 事件。在函数内部,使用 window.open 弹出一个新窗口以及您想要将用户发送到的地址。根据用户配置浏览器的方式,浏览器可能会打开另一个选项卡。函数结束时,返回 false。
好吧,实际上不需要编写任何其他代码,因为表单已经是 JS 驱动的。在您链接到的该页面的源代码中,找到以下行:
将其替换为以下行:
就是这样。该按钮将弹出另一个页面或选项卡。
警告
该页面有些过时,某些搜索引擎无法正常工作(生成的链接是错误的)。
1) Don't do that
2) Really don't do that
3) In the case that you have to do that, bind a function to the onclick event of the "search" button. Inside the function, use window.open to pop up a new window with the address you want to send the user to. Depending on how the user configured his browser, the browser may instead open another tab. At the end of the function, return false.
OK actually there's no need to write any other code because the form is already JS-driven. In the source of that page you linked to, find the following line:
Substitute it with the following line:
That's it. The button will pop up another page or tab.
WARNING
That page is somewhat outdated and some of the search engines don't work properly (the link generated is wrong).