javascript |
您所在的位置:网站首页 › href调用function › javascript |
如前所述,您必须控制其他页面。如果在同一个站点,可以在一个框架中打开它 | 框架 | 新窗口和 javascript 可以与该框架通信,但您不能关闭当前窗口(调用窗口时脚本消失)。如果域与“完全”不匹配,则会生成错误。您无法在该域的域和子域之间进行通信。 您的代码执行以下操作: function gotonewpage() { window.location.href = "WEBSITE" // current window with script goes away. x = document.getElementById("s") // this code never sees the light of day. }此代码访问同一域上 iframe 的元素。 MySite=document.getElementById("frame"); x = MySite.contentDocument.getElementById("s");对于弹出式交换是通过消息。 MyChildMySite = window.open("website"); MyChildMySite.ProcessParentMessage('Message to the child');在子页面上,相同的域 function ProcessParentMessage(message) { window.opener.ProcessChildMessage(document.getElementById("s")); }并返回父页面,相同的域 function ProcessChildMessage(s) { x = s; // not sure what you want to do from here. }让我补充一下浏览器对安全性的重视;如果您在他们的实施中发现安全错误,请联系他们以获得可能的奖励。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |