我怎样才能添加根路径Javascript

时间:2012-11-09 09:22:28

标签: javascript asp.net jquery-blockui

如何在Javascript中引用根路径,如:

$.blockUI.defaults.growlCSS['background'] = 'url(~/Styles/images/check48.gif) no-repeat 10px 10px #000; ';

1 个答案:

答案 0 :(得分:1)

Biju想知道如何在javascript中解决这个问题,一种方法是:

var path = window.location.protocol + '//' + window.location.host + '/'; // or whatever you want to set it to
$.blockUI.defaults.growlCSS['background'] = 'url(' + path + 'Styles/images/check48.gif) no-repeat 10px 10px #000; ';