プロジェクトで MVC2 を使用しています。「.aspx」ページに次のコードがあり、「.ascx」ページを表示するかどうかを決定します。
<% if(Model.MRxECG != null) { %>
<div id="ecg">
<% Html.RenderPartial("ecgDetails", Model); %>
</div>
<% } %>
これは「.ascx」ページのコードです。
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Intranet.Models.CareRecord.CareRecordSummaryModel>" %>
<script type="text/javascript">
function resImage(image)
{
var resize = 200; // amount in percentage
var oldheight = 150; // height of your image
var oldwidth = 250; // width of your image
var X = event.x;
var Y = event.y;
var newHeight = oldheight * (resize / 100);
var newWidth = oldwidth * (resize / 100);
image.style.height = newHeight;//height of new image
image.style.width = newWidth;// width of new image
var c = image.parentNode;
c.scrollLeft = (X * (resize / 100)) - (newWidth / 2) / 2; //this is for
c.scrollTop = (Y * (resize / 100)) - (newHeight / 2) / 2;//new center
}
</script>
<div>
<table class="layout" width="900px">
<tr>
<td>
<img src='<%= Url.Action("ShowMRx12LeadImage", "CareRecord", new { id = Model.CareRecord.CaseNumber}) %>'
alt="12-Lead ECG" style="width: 1000px; height: 800px;" onmouseover="resImage(this)" />
</td>
</tr>
</table>
</div>
画像はマウスオーバー イベントでズームしません。「.aspx」ページに Javascript コードを配置しようとしましたが、うまくいきませんでした。これを機能させるにはどうすればよいですか?
JavaScript が .ascx ページで機能するかどうかわかりません。ズームイン機能を実現するには、jQuery を使用する必要がありますか?