我想从asp获取ImageUrl:Image Id =“imgIdCard”并设置为参数,而不是要加载一个固定值。
注意:ImageUrl的值已经分配了,为什么,虽然没有出现,但已经有了值。
这是HTML代码。
<div class="page" >
<div class="box cf">
<div class="left">
<span class="demowrap">
<asp:Image ID="imgIdCard" class="imgClass" runat ="server"/>
</span>
</div>
<div id="dialogEditor">
<div class="images">
<div id="cropzoom_container">
</div>
</div>
</div>
在源代码中,现在我有一个固定值[source:'xray-linux.jpg',]但是我想传递asp Image Id =“imgIdCard”的imageUrl的值而不是这个固定值。 / p>
<script type="text/javascript">
$(document).ready(function () {
var cropzoom = $('#cropzoom_container').cropzoom({
width: 400,
height: 300,
bgColor: '#CCC',
enableRotation: true,
enableZoom: true,
selector: {
centered: true,
borderColor: 'blue',
borderColorHover: 'yellow'
}
,
image: {
source: 'xray-linux.jpg',
width: 1920,
height: 1450,
minZoom: 10,
maxZoom: 150
}
});
});
在Jquery中必须使用哪条指令来替换下面的行并从imageUrl中赋值?
source: 'xray-linux.jpg',
答案 0 :(得分:1)
asp:Image
在HTML中呈现为<img>
,ImageUrl
呈现为src
。因此,请尝试使用jQuery代码:
source: $("#imgIdCard").attr("src"),
答案 1 :(得分:0)
试试这个 -
$("#"+"<%= imgIdCard.ClientID%>").attr("src");