在jquery中如何打开新的窗口
程序员文章站
2022-03-24 13:52:10
...
在jquery中打开新窗口的方法:1、创建一个form表单,通过表单提交来实现新标签页打开;2、通过“window.open('_blank');”来打开;3、通过“setTimeout(window.open(...);”方式来打开。
本教程操作环境:windows7系统、jquery3.3.1版,该方法适用于所有品牌电脑。
推荐:《jquery视频教程》
jquery新窗口打开的几种方式
第一种:创建一个form表单,通过表单提交来实现新标签页打开。
var form = document.createElement(‘form‘); form.action = ‘www.baidu.com?id=1‘; form.target = ‘_blank‘; form.method = ‘POST‘; document.body.appendChild(form); form.submit();
第二种:
var tempwindow=window.open('_blank'); tempwindow.location='www.baidu.com' ;
第三种:(与第一种相似)
/* 在新窗口中打开 */ function openNewWindow(url) { var a = document.createElement('a'); a.setAttribute('href', url); a.setAttribute('target', '_blank'); var id = Math.random(10000, 99999); a.setAttribute('id', id); // 防止反复添加 if (!document.getElementById(id)) { document.body.appendChild(a); } a.click(); } //方法调用 openNewWindow('www.baidu.com');
以上就是在jquery中如何打开新的窗口的详细内容,更多请关注其它相关文章!
上一篇: 选择排序的两种实现方式(C语言)
下一篇: 归并排序C/C++、C#代码实现
推荐阅读
-
Vue中在新窗口打开页面及Vue-router的使用
-
CefSharp禁止弹出新窗体,在同一窗口打开链接,或者在新Tab页打开链接,并且支持带type="POST" target="_blank"的链接
-
如何解决Jquery插件nicescroll在ie8中出现的滚动问题
-
Excel中的宏怎么删除如何解决打开或保存表时弹出询问窗口
-
在WPS文字中如何随着插入的表格数据快速产生新的图表
-
Vue中在新窗口打开页面及Vue-router的使用
-
javascript-怎样在一个新窗口里打开本php页面中的一个函数写成的html页面
-
CefSharp禁止弹出新窗体,在同一窗口打开链接,或者在新Tab页打开链接,并且支持带type="POST" target="_blank"的链接
-
windows虚拟桌面_如何在Windows 10的新虚拟桌面中打开应用程序或文件
-
如何在vim中交换两个打开文件(在拆分中)的位置?