使用 javascript 将页面加载到 Iframe

Load Page to Iframe with using javascript

本文关键字:加载 Iframe javascript 使用      更新时间:2023-09-26

我得到了带有参数的页面工作,并且 ı 想在 iframe 中显示它。 但是,当 ı 设置为 iframe 位置时,我的 iframe 不会加载所有 JavaScript。通常页面工作。我的 ıframe 也在工作。但现在它不起作用。为什么?

 window.frames["MyFrame"].location = "Component/Component.php?pagename="+$(Element).attr("page-name");

这是我设置iframe位置的JavaScript代码。

尝试src属性:

window.frames["MyFrame"].src = //...

试试这个

document.getElementById('MyFrame').src="Component/Component.php?pagename="+$(Element).attr("page-name");