2013-06-20 66 views
0

我正在研究一個asp.net MVC 4應用程序。我有一個細節圖標,將放置在每個動態創建的記錄的開頭。我想讓這張圖像成爲翻轉圖像。如果我的想法是正確的,我必須使用HTML來做到這一點,因爲如果我使用jQuery或CSS,我會遇到選擇問題,因爲我不能附加一個ID。這是我對這個問題的代碼段:jQuery追加:動態翻轉圖像

$('#@tableName > tbody:last').append('<tr> 
    <td> 
     <a href="#" style="text-decoration:none; float:left;" 
     onclick="LoadLaunchDetails(' + launchID + ', @automated)"> 
     <img src ="@Url.Content("~/Content/images/buttons/icon-details-ns.png")" 
     onmouseover="this.src="@Url.Content("~/Content/images/buttons/icon-details-s.png")"" 
     onmouseout="this.src="@Url.Content("~/Content/images/buttons/icon-details-s.png")""/> 
     </a> Launch #' + return_str + '</td><td style = "text-align:right">'+ dateStr + 
    '</td> 
    </tr>'); 

我遇到的問題是在onmouseover和onmouseout屬性中的引號。當我使用火蟲時,我看到了onmouseover="this.src="我嘗試了許多不同的方法。這甚至有可能嗎?謝謝。

回答

1
src ="@Url.Content("~/Content/images/buttons/icon-details-ns.png")" 

src爲@Url.Content(

錯誤這裏開始。您必須使用反斜槓正確地轉義您的代碼。