2012-08-26 20 views

回答

3

您可以使用window.setTimeout()在給定的秒數後將其刪除。

$(function() { 
    $('<iframe id="myFrame" name="myFrame" src="myUrl">').appendTo('body'); 

    // Remove it after 20 seconds 
    setTimeout(function() { 
     $("#myFrame").remove(); 
    }, 20000); 
}); 
+0

謝謝。一個錯字:'src =「」' –

+0

@EricYin Ooh感謝您的領導,抱歉。 –