jquery
  • asp.net-mvc
  • internet-explorer-8
  • 2010-07-01 103 views 0 likes 
    0

    我在Windows 7中使用Visual Studio 2008.ajax調用後,我動態構建圖像標記並將其設置爲像這樣的div。將圖像標記設置爲div不會加載圖像

    var imageLocation="<%= Url.Action("Show", "Images", new { Id = Model.LoginUser.UserId })%>"; 
    var markup = '<img class="profile-Image" src="' + imageLocation + '"/>'; 
    
    $('.divImgdisplay').html(markup); 
    

    變量imageLocation指向正確的URL。當此標記設置爲div元素時,它不會在IE 8和IE8兼容模式下加載圖像。但它正在加載圖像的Firefox。調試後,我們發現服務器沒有收到來自IE的圖像請求。你能幫我們嗎?

    +0

    是IE緩存的形象呢? – 2010-07-01 13:09:01

    回答

    0

    也許有幫助,設置這樣的imageLocation:

    $('.divImgdisplay img').attr('src', imageLocation); 
    
    0

    如果你不喜歡這樣寫道:

    $('<img class="profile-Image" />').attr('src', imageLocation).appendTo($('.divImgdisplay')); 
    

    $('.divImgdisplay').append($('<img class="profile-Image" />').attr('src', imageLocation)); 
    
    相關問題