如何同时使用javascript或jquery加载iframe ?示例:我有iframe[0], iframe[1], iframe[2], iframe[3],如何同时加载它们?
设置它们的src
属性:
$("iframe").each(function () {
$(this).attr("src", ...);
});
jQuery的使用都很好,但纯JS也可以,甚至IE8都支持。;)
el.setAttribute('attribute', value);
在你的例子中,它应该是:
el.setAttribute('src', 'the/path/to/whatever');