Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/463.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在GreaseMonky中使用隐藏的iframe连接到服务器_Javascript_Dom_Greasemonkey - Fatal编程技术网

Javascript 如何在GreaseMonky中使用隐藏的iframe连接到服务器

Javascript 如何在GreaseMonky中使用隐藏的iframe连接到服务器,javascript,dom,greasemonkey,Javascript,Dom,Greasemonkey,首先,我创建了一个隐藏帧,如下所示: var oHiddenFrame = null; if(oHiddenFrame == null){ oHiddenFrame = document.createElement("iframe"); oHiddenFrame.name = "hiddenFrame"; oHiddenFrame.id = "hiddenFrame"; oHiddenFrame.style.height = "0px"; oHiddenFrame.style

首先,我创建了一个隐藏帧,如下所示:

var oHiddenFrame = null;
if(oHiddenFrame == null){
  oHiddenFrame = document.createElement("iframe");
  oHiddenFrame.name = "hiddenFrame";
  oHiddenFrame.id = "hiddenFrame";
  oHiddenFrame.style.height = "0px";
  oHiddenFrame.style.width = "0px";
  oHiddenFrame.style.position = "absolute";
  oHiddenFrame.style.visbility = "hidden";
  document.body.appendChild(oHiddenFrame);
}
var fnLocation = function(){
    frames["hiddenFrame"].location.href = "http://meckmeck.cn";
}

var oButton = document.getElementById("mb_submit");
oButton.addEventListener("click", fnLocation, false);
然后,我向按钮添加一个事件,如下所示:

var oHiddenFrame = null;
if(oHiddenFrame == null){
  oHiddenFrame = document.createElement("iframe");
  oHiddenFrame.name = "hiddenFrame";
  oHiddenFrame.id = "hiddenFrame";
  oHiddenFrame.style.height = "0px";
  oHiddenFrame.style.width = "0px";
  oHiddenFrame.style.position = "absolute";
  oHiddenFrame.style.visbility = "hidden";
  document.body.appendChild(oHiddenFrame);
}
var fnLocation = function(){
    frames["hiddenFrame"].location.href = "http://meckmeck.cn";
}

var oButton = document.getElementById("mb_submit");
oButton.addEventListener("click", fnLocation, false);
单击该按钮时,出现了一个错误:

frames.hiddenFrame is undefined

没有所谓的
document.frames
名称
索引的帧数组是
窗口。frames
(也称为just
frames

0-iframes是如此老派,现在大多与恶意软件安装漏洞有关(尤其是在中文页面上)。改用XMLHttpRequest怎么样