これは jQuery ではなく、純粋な Javascript です。
function setIframe(element,location){
var theIframe = document.createElement("iframe");
theIframe.src = location;
theIframe.setAttribute("weight", "500");
theIframe.setAttribute("width", "500");
theIframe.setAttribute("scrolling", "yes");
element.appendChild(theIframe);
}
これはあなたの質問の一部ではありませんが、jQuery で div を切り替える方法は次のとおりです。
マークアップ:
<input type="button" value="Toggle Div" id="btnToggle"/>
<div id="randomContent">
This is random Content.
<br />
This is random Content.
<br />
This is random Content.
<br />
This is random Content.
<br />
This is random Content.
<br />
This is random Content.
<br />
</div>
jQuery:
$(document).ready(function () {
$("#btnToggle").bind("click", function () {
$("#randomContent").toggle();
});
});