例如,这有效吗?`id`属性在iframe中需要是唯一的吗?
<!doctype html>
<html>
<head>
<title>Some Iframes</title>
</head>
<body>
<iframe id="frame1" src="/html/test-frame.html"></iframe>
<iframe id="frame2" src="/html/test-frame.html"></iframe>
</body>
</html>
所在的文件test-frame.html
具有内容:
<!doctype html>
<html>
<head>
<title>Test Iframe</title>
</head>
<body>
<button id="subscribe">Subscribe</button>
</body>
</html>
我希望能够使用相同的HTML和脚本相同的一组I帧。
你确实在iframe元素中有内容吗?它会被所有支持帧的浏览器忽略,这意味着所有的浏览器,除非特别配置为假装它们不会执行帧。你的意思是'iframe'元素具有'src'属性是指包含相同元素的文档? –
是的。我更新了这个例子,以减少人为操作。 – Mack