我在这里 try catch iframe 中的图像(url)。但它不起作用。这是我的代码:
<div id="iframe">
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" class="border2">
<tr>
<td height="403">
<asp:UpdatePanel ID="Update" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<iframe id="IFTrendAnalysis" name="IFTrendAnalysis" scrolling="auto" runat="server" width="100%" height="403" frameborder="0"></iframe>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="imgBTNSalesTrendChart" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</div>
和图片路径(动态生成)
http://10.232.151.132:8080/pentaho/getImage?image=picture658447691538512233.png
和
$(function () {
$("#MainContent_IFTrendAnalysis img").click(function () {
var update = $("<div>").append(
$("<img>").attr("src", $(this).attr("src"))
).html();
$("#content").val(function (i, v) {
return v + update;
});
});
});
有什么建议吗?
最佳答案
如果您的 iframe 页面与父页面在同一个域中,那么这应该可以帮助您:
var name = "img_Sample";
$('#MainContent_iframeDetail').get(0).contentWindow.document.getElementById(name).src
我想,您也应该能够使用 Jquery 代替 document.getElementByID
。
关于c# - 如何在 iframe 中捕获图像(url)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10350678/