我有一個外部的Javascript頁面位於../Scripts/CBox/
父文件夾下。 位於同一文件夾中的圖像。我想從那裏設置使用Jquery的控件background-image
。當我使用此代碼時,它將background-image
路徑設置爲localhost:7905/ddl_arrow.png
,其中localhost:7905
是我的asp.net開發服務器。使用jquery腳本從當前文件夾設置css圖像頁面
function createAutoCBox(boxCtrl) {
$(boxCtrl).css('background-image', 'url("ddl_arrow.png")');
$(boxCtrl).css('background-repeat', 'no-repeat');
$(boxCtrl).css('background-position-x', '99%');
$(boxCtrl).css('background-position-y', '-2px');
$(boxCtrl).mousemove(jqAutoCompleteMouseMove);
$(boxCtrl).keyup(jqAutoCompleteKeyUp);
$(boxCtrl).mousedown(jqAutoCompleteMouseDown);
}
我想讓CBox作爲一個可再發行的控件。 所以不能使用確切的文件夾名稱。 –
將回到這個時候,我找到了替代它。 – Sajal