2009-08-19 63 views
0

我在我的页面加载事件中注册脚本,以便打开thickbox页面。但有些时候只会出现灰色背景,而不是厚纸页面。让我知道我是否缺少任何东西。以下是注册thickbox的代码。任何帮助将不胜感激。在IE浏览器的页面加载时,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()) 

我是新来的forum..let我知道如果任何类似的线程有解决方案吗?

由于 加比

+0

何时只有所述灰色背景上,是它看似随机的或者是有一个模式?另外,你是否也有tb_show()函数的代码? – 2009-08-19 15:38:15

+0

这是不是有任何理由不只是在aspx方的脚本块?代码看起来是正确的,但如果可能的话,我会尝试将它放在页面的底部,而不用ASP的帮助。此外,请在周期,预渲染或渲染事件的后期尝试。 – Jab 2009-08-19 18:27:00

+0

嗨拉斯, 它发生随机,这也是在IE浏览器。 我不知道如何添加评论中的代码..它有内容长度的限制。无论如何,我正在使用3.1厚盒版。 “Thickbox 3.1 - 一个盒子统治他们。” 感谢您的意见。 – 2009-08-24 16:14:06

回答

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. 
      }