Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/413.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
Html<;对象>;,从外部读取javascript检测_Javascript_Jquery_Html_Animation - Fatal编程技术网

Html<;对象>;,从外部读取javascript检测

Html<;对象>;,从外部读取javascript检测,javascript,jquery,html,animation,Javascript,Jquery,Html,Animation,index.html 有一个动画我想显示,但当动画是芬兰语,我希望它关闭。 我试着让网页消失,但它确实工作,但屏幕后,它是不可读取的 battle.html document.getElementById(“战斗体”).style.display=“无” 此代码在动画完成时播放。基本上,我在它周围画了一个边框,当它看不见的时候,告诉它在哪里 我想知道是否有可能在index.html中编辑标记,而不是像我所做的那样在battle.html中编辑 一个例子 index.html <body&

index.html

有一个动画我想显示,但当动画是芬兰语,我希望它关闭。 我试着让网页消失,但它确实工作,但屏幕后,它是不可读取的

battle.html
document.getElementById(“战斗体”).style.display=“无”
此代码在动画完成时播放。基本上,我在它周围画了一个边框,当它看不见的时候,告诉它在哪里

我想知道是否有可能在index.html中编辑
标记,而不是像我所做的那样在battle.html中编辑

一个例子 index.html

<body>
<object id="battle" data="battle.html"></object>
</body>

battle.html

<body>
    <button id="" onclick="closing(); ">close</button>
    <script>
    function closing() {
    window.close()
    </script>
</body>

关闭
函数关闭(){
window.close()
我有点想关闭对象,但它不是这样工作的,所以要使对象显示:无;
但是为了同样的工作,您需要将js代码添加到index.html,但是index.html不会读入

,您可以使用该方法

目标页面


setTimeout(函数(){
parent.postMessage('close-me','*');
}, 2000);
index.html

window.onmessage=函数(e){
如果(例如,数据===‘关闭我’){
控制台日志(“应删除”);
obj.parentNode.removeChild(obj);
}
};
object{border:1px solid}
您可以使用该方法

目标页面


setTimeout(函数(){
parent.postMessage('close-me','*');
}, 2000);
index.html

window.onmessage=函数(e){
如果(例如,数据===‘关闭我’){
控制台日志(“应删除”);
obj.parentNode.removeChild(obj);
}
};
object{border:1px solid}

请制作一把小提琴。@Bla…不能,因为小提琴只使用一个html页面。
对象id=“battle”
document.getElementById(“battlebody”).style.display=“none”
…两个不同的id…为什么?你试过
document.getElementById(“battle”).style.display=“none”
@JaromandaX它有两个不同的html文件,我已经试过给出相同的id了吗?所以,对象有一个id,而没有显示的东西有另一个id,你可以使用你没有显示的任何东西的id来隐藏对象…如果你没有发布相关的代码,有人应该如何帮助你…是“隐藏”的代码吗对象内的页面或包含该对象的页面中的内容?请制作一个fiddle…@Bla…不能,因为fiddle只使用一个html页面。
object id=“battle”
document.getElementById(“battlebody”).style.display=“none”
…两个不同的id…为什么?您尝试过
document.getElementById(“battle”).style.display=“none”
@JaromandaX它的两个不同的html文件,我已经尝试过给出相同的id了吗?因此,对象有一个id,而没有显示的东西有另一个id,你可以使用你没有显示的任何东西的id来隐藏该对象…如果你没有发布相关代码,有人应该如何帮助你…是代码吗“隐藏”对象内部页面或包含对象的页面中的内容?谢谢,我会尽快尝试。谢谢,我会尽快尝试