【发布时间】:2011-12-26 09:55:21
【问题描述】:
我创建了一个 iframe 来将图像上传并显示到服务器中,而无需刷新页面。请帮助我解决将保存的图像从 iframe 拖放到 div 中的解决方案。
在 iframe(iframeImage.aspx) 中使用以下代码显示来自服务器的图像:
<div>
<asp:DataList ID="dtlist" runat="server" RepeatColumns="4" CellPadding="5">
<ItemTemplate>
<div id="divImage" runat="server" onclick="Test()" class="draggable">
<asp:Image Width="100" ID="Image1" ImageUrl='<%# Bind("Name", "~/MyImages/{0}") %>' runat="server" />
</div>
<br />
<asp:HyperLink ID="HyperLink1" Text='<%# Bind("Name") %>' NavigateUrl='<%# Bind("Name", "~/MyImages/{0}") %>' runat="server"/>
</ItemTemplate>
<ItemStyle BorderColor="Brown" BorderStyle="dotted" BorderWidth="3px" HorizontalAlign="Center"
VerticalAlign="Bottom" />
</asp:DataList>
</div>
从后面的代码中,我将图像绑定到数据列表中。
目前,我需要将图像拖放到主div中(CustomDesign.aspx的reportHeader)。下面的代码用于将文本绑定到主div:
function CreateTextLineLabel(textAreaElt) {
var id = "Text1" + count.num++;
$('#reportHeader').append('<div id="' + id + '" class="draggable" ondblclick="showPopup(this)"><span>' + $(textAreaElt).val() + '</span></div> ');
$("#" + id).draggable({ revert: "invalid" });
$("#" + id).resizable();
$("#reportHeader").droppable({
activeClass: "ui-state-hover",
hoverClass: "ui-state-active",
drop: function(event, ui) {
$(this)
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
}
});
$(textAreaElt).remove();
}
【问题讨论】:
-
需要更多信息。所有页面都在同一个域上运行吗?