Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.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 <;对象类型=";text/html"&燃气轮机</对象>;?_Javascript_Jquery_Object Tag - Fatal编程技术网

Javascript <;对象类型=";text/html"&燃气轮机</对象>;?

Javascript <;对象类型=";text/html"&燃气轮机</对象>;?,javascript,jquery,object-tag,Javascript,Jquery,Object Tag,我可以使用访问加载在中的本地内容 $(“#frame”).contents().find('div').css(…) 如果改用(同一本地站点),则内容功能不起作用 还有别的办法吗?还是我错过了什么 下面是测试代码: HTML: 对象标记立即关闭,因此它没有要查找的子div <object id="frame" type="text/html" data="/nastysite/index.php" width="100%" height="100%"></object>

我可以使用访问加载在
中的本地内容

$(“#frame”).contents().find('div').css(…)

如果改用
(同一本地站点),则内容功能不起作用

还有别的办法吗?还是我错过了什么

下面是测试代码:

HTML:


对象标记立即关闭,因此它没有要查找的子div

<object id="frame" type="text/html" data="/nastysite/index.php" width="100%" height="100%"></object>


虽然他确实需要使用完整的结束标记,而不是简短的语法,但我仍然不确定它是否会公开他正在“导入”的页面的DOM。尝试使用简短的语法,但没有任何效果(网站仍然成功加载)。iframe是否从其他域加载?我相信JavaScript不允许这样。使用本地加载内容的iframe尝试您的代码。它是本地内容。如果您已经在使用jquery,为什么不使用
$(targetElement).load('/nastysite/index.php')?这似乎比使用object方法简单得多,这是我的第一个想法,但是这个站点包含了jquery的一个旧版本,有很多插件。当然,我尝试了noConflict()和noConflict(true),但没有取得很大成功。你有没有发现这个问题?我有同样的问题。
$(document).ready(function() {

    alert("go ?");  //temporary solution to wait until everything is loaded.
    $("#frame").contents().find('div').css("background-color", "red"); //nothing appens
    console.debug($("#frame").contents().find('div'));  //nothing
});
<object id="frame" type="text/html" data="/nastysite/index.php" width="100%" height="100%"></object>