我正試圖在新窗口中打開每個圖像的全尺寸圖像。我使用此代碼:使用剃刀和javascript在新窗口中打開圖像
<script type="text/javascript">
function openImage(imageUrl) {
window.open(imageUrl);
}
@foreach (var image in Model.Images)
{
<img src="@Url.Action("Thumbnail", "Done", new { width = 150, height = 150, file = @imagen.filename })" alt="@imagen.filename" onclick="openImage('@Url.Content(ViewBag.Path + @imagen.filename)')" />
}
但是使用這個,當我點擊圖片不能打開任何東西。
你能幫我解決這個問題嗎?
謝謝你在先進
編輯的功能openImage由於錯誤代碼
JS控制檯中的任何錯誤? 請調試'imageUrl'到'openImage'的值。 – phts
BTW'imageUrl'參數和'window.open'中的'imgUrl'。這是你的問題的原因? – phts