在IE浏览器中,页面加载时不会加载(一致)加厚箱页面

时间:2009-08-19 15:32:03

标签: c# asp.net jquery thickbox

我正在我的页面加载事件上注册脚本以打开厚箱页面。但有些时候只出现灰色背景而不是厚盒页面。如果我错过任何东西,请告诉我。以下是注册thickbox的代码。任何帮助将不胜感激。

 Dim sb As New StringBuilder()
            sb.AppendLine("<script type=""text/javascript"">")
            sb.AppendLine("jQuery(document).ready(function($)")
            sb.AppendLine("{")
            sb.AppendLine("tb_show(null, ""Thickbox.aspx?TB_iframe=true&height=500&width=500&modal=true"", null)")
            sb.AppendLine("});")
            sb.AppendLine("</script>")
            Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "RegisterWidgetScript", sb.ToString())

我是论坛新手..我知道是否有任何类似的线程有解决方案?

由于 加比

1 个答案:

答案 0 :(得分:0)

I have fixed this issue.

In IE the imgLoader variable is null since I am calling the tb_show from the asp.net code behind. So I added the below code to check if the object is null and then initialize and assign the image url.

//Check if the image loader is null, this occurs when we call the tb_show method from the code behind
    if ( typeof imgLoader === 'undefined')
            {
                imgLoader = new Image();// preload image
                      imgLoader.src = tb_pathToImage;//Animated loader gif image.
            }