javascript window.open()传递args [英] Javascript window.open() passing args
本文介绍了javascript window.open()传递args的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 window.open()
将一些参数传递给另一个页面。
I am trying to use window.open()
to pass along some arguments to another page.
我希望页面是
myPage.html?img=1.jpg
在该页面上,我将使用javascript获取arg并显示图像。
Where once on that page I will use javascript to get the arg and show the image.
但是我无法弄清楚如何使用window.open()导致它说不存在我能理解的页面。
However I cannot figure out how to do this with window.open() cause it says the pages does not exist which I can understand.
window.open('myPage.html?img=1.jpg','_blank')
<希望这是有道理的,我甚至不知道是否可能。
Hope this makes sense and I don't even know if it is possible.
推荐答案
myPage.html应该存在,
和检查window.open上的文档
myPage.html should exist, and check the docs on window.open
传递vars:
var variable = "lol";
var w = window.open("http://example.com");
w.variable = variable;
或yopu可以访问操作窗口:
or yopu can visit the opeing window:
var variable = window.opener.variable;
这篇关于javascript window.open()传递args的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文