Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery Facebox图像不';使用asp.net客户端脚本时不显示_Jquery_Asp.net_Facebox_Clientscript - Fatal编程技术网

Jquery Facebox图像不';使用asp.net客户端脚本时不显示

Jquery Facebox图像不';使用asp.net客户端脚本时不显示,jquery,asp.net,facebox,clientscript,Jquery,Asp.net,Facebox,Clientscript,我正在ASP.net项目中使用FaceBox。当我从ASPX页面中的硬编码脚本块调用它时,它工作得非常好,如下所示: <script type="text/javascript"> jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox({ loadingImage: '../../CSS/FaceBox/Images/loading.gif',

我正在ASP.net项目中使用FaceBox。当我从ASPX页面中的硬编码脚本块调用它时,它工作得非常好,如下所示:

<script type="text/javascript">

    jQuery(document).ready(function($) {
        $('a[rel*=facebox]').facebox({
            loadingImage: '../../CSS/FaceBox/Images/loading.gif',
            closeImage: '../../CSS/FaceBox/Images/closelabel.png'
        })
    });
</script>

jQuery(文档).ready(函数($){
$('a[rel*=facebox]')。facebox({
loadingImage:“../../CSS/FaceBox/Images/load.gif”,
closeImage:“../../CSS/FaceBox/Images/closelabel.png”
})
});
但是,当我将该代码移到后面的代码中,以便首先执行一些服务器端代码时,该框将打开,但图像不再显示(将显示缺少的图像图标。单击该图标确实有效)。以下是我使用的代码:

Dim sbClientScript As System.Text.StringBuilder = New System.Text.StringBuilder()

sbClientScript.AppendLine("<script type='text/javascript'>")
sbClientScript.AppendLine("  jQuery.facebox({                                                   ")
sbClientScript.AppendLine("      ajax: 'EditQuestion.aspx',                                     ")
sbClientScript.AppendLine("      loadingImage: '../../CSS/FaceBox/Images/loading.gif',          ")
sbClientScript.AppendLine("      closeImage: '../../CSS/FaceBox/Images/closelabel.png'          ")
sbClientScript.AppendLine("    });                                                              ")
sbClientScript.AppendLine("</script>")

    If Not Page.ClientScript.IsStartupScriptRegistered("skFacebox") Then
        Page.ClientScript.RegisterStartupScript(Me.GetType(), "skFacebox", sbClientScript.ToString())
    End If
Dim sbClientScript As System.Text.StringBuilder=New System.Text.StringBuilder()
sbClientScript.AppendLine(“”)
sbClientScript.AppendLine(“jQuery.facebox({”)
sbClientScript.AppendLine(“ajax:'EditQuestion.aspx',”)
sbClientScript.AppendLine(“loadingImage:'../../CSS/FaceBox/Images/loading.gif',”)
sbClientScript.AppendLine(“closeImage:'../../CSS/FaceBox/Images/closelabel.png'”)
sbClientScript.AppendLine(“}”);“”)
sbClientScript.AppendLine(“”)
如果不是Page.ClientScript.IsStartupScriptRegistered(“skFacebox”),则
Page.ClientScript.RegisterStartupScript(Me.GetType(),“skFacebox”,sbClientScript.ToString())
如果结束
我尝试过改变参数的顺序(将“ajax”放在最后)。我试着把东西分成不同的函数。我尝试在硬编码的脚本块中设置loadingImage和closeImage。什么都没用

有人知道设置图像参数的正确语法吗

谢谢

试试看

<%="~/CSS/FaceBox/Images/loading.gif"%> instead of '../../CSS/FaceBox/Images/closelabel.png' 
而不是“../../CSS/FaceBox/Images/closelabel.png”

多亏了Firebug和一些尝试和错误,我想出了正确的语法和顺序:

sbClientScript.AppendLine("jQuery.facebox.settings.loadingImage = '../../CSS/FaceBox/Images/loading.gif',")
sbClientScript.AppendLine("jQuery.facebox.settings.closeImage = '../../CSS/FaceBox/Images/closelabel.png'")
sbClientScript.AppendLine("<script type='text/javascript'>")
sbClientScript.AppendLine("  jQuery.facebox({")
sbClientScript.AppendLine("      ajax: 'EditQuestion.aspx'")
sbClientScript.AppendLine("    });")
sbClientScript.AppendLine("</script>")
sbClientScript.AppendLine(“jQuery.facebox.settings.loadingImage='../../CSS/facebox/Images/loading.gif',”)
sbClientScript.AppendLine(“jQuery.facebox.settings.closeImage=”../../CSS/facebox/Images/closelabel.png'))
sbClientScript.AppendLine(“”)
sbClientScript.AppendLine(“jQuery.facebox({”)
sbClientScript.AppendLine(“ajax:'EditQuestion.aspx'))
sbClientScript.AppendLine(“}”);“”)
sbClientScript.AppendLine(“”)