且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jQuery在按钮单击上创建一个iframe?

更新时间:2023-02-15 15:10:24

请确保您不会一次又一次打开相同的iframe.检查它是否存在!

Make sure you don't open the same iframe again and again. Check if it exists!

$('#button').click(function() {
    if($('#myIframe').size() == 0) {
        $('<iframe id="myIframe" src="http://***.com"></iframe>');
    }
});