0
我正在使用colorbox在iframe中打開頁面。在該網頁我用ajax文件上傳到異步上傳圖像,然後結合的新images.I一個DataList具有相同的頁面上的按鈕使用此代碼關閉colorbox on postback
protected void Cancel_Click(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "none", "<script>$(function(){closeIframe()});</script>");
}
它工作正常關閉的iframe,當我不上傳任何圖片並點擊它。它關閉了顏色框,但是當我上傳圖像並點擊它時,它會帶我到另一個頁面,並給出以下js錯誤。
Uncaught TypeError: Cannot call method 'close' of undefined
這就是我用它來關閉彈出
<script>
function closeIframe() {
parent.$.fn.colorbox.close();
}
</script>
我認爲colorbox jquery無法加載。 – Sender