【发布时间】:2011-11-18 14:12:25
【问题描述】:
假设我在 MVC 3 应用程序中的某个地方
if (Model.ImageListGallery != null)
{
<h3>@ImagesTranslation.Gallery</h3>
foreach (var imageInGallery in Model.ImageListGallery)
{
<div id="@imageInGallery.IdImage">
<a rel="group" href= "@Url.Action("displaybig", "news", new { idNews = Model.IdNews, idImage = imageInGallery.IdImage })">
<img src= "@Url.Action("displaysmall", "news", new { idNews = Model.IdNews, idImage = imageInGallery.IdImage })" alt=""/></a>
@Html.Label(ImagesTranslation.Description)
@Html.TextArea("Description", imageInGallery.Description, new { id = "area" + imageInGallery.IdImage, onfocus = "removeDisabledBtnOnImage('" + imageInGallery.IdImage + "')" })
<button disabled="disabled" id="btn@(imageInGallery.IdImage)" onclick="saveDescription('@imageInGallery.IdImage')">@CommonTranslations.Save</button>
<img class="@imageInGallery.IdImage" src="@Href("~/Content/delete.png")" onclick="deleteImage('@imageInGallery.IdImage')" title="@ImagesTranslation.DeleteImage" alt=""/>
</div>
}
}
在那种情况下你会如何使用不显眼的 JavaScript 和 jQuery(事件 onfocus 和 onclick?
【问题讨论】:
-
我的意思是在 mvc 3 中这种编程是有价值的。正如我所见,Web 开发正试图避免以这种方式使用 html 事件
标签: javascript jquery asp.net-mvc asp.net-mvc-3