0
我有一個div,其內容將通過JavaScript填充返回圖像,但我problemn是:我有4個下拉列表用的AutoPostBack =真實,它使我的div的內容消失...... 如何保存圖像總是出現?我讀過有關ViewState的,但不能做任何事情......如何在ViewState中保存一個div及其內容?
這裏是我的代碼:
<script language="javascript" type="text/javascript">
function fonte(lat, lon) {
var src = "http://maps.google.com/maps/api/staticmap?center=" + lat + "," + lon + "&zoom=15&size=540x280&maptype=roadmap&markers=color:red|" + lat + "," + lon + "&sensor=false";
testando(src, 540, 280, "Mapa");
}
function endereco(endereco) {
var fonte = endereco.split(' ').join('+');
var src = "http://maps.google.com/maps/api/staticmap?center=" + fonte + "&zoom=16&size=540x280&maptype=roadmap&markers=color:red|" + fonte + "&sensor=false";
testando(src, 540, 280, "Mapa");
}
function testando(src, width, height, alt) {
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
document.getElementById("mapa").innerHTML=img;
}
</script>
.NET
<div class="formLine" id="mapa1" style="width:100%; height:100%" align="center" runat="server">
,我也試圖從DIV改變面板,但沒有任何變化
<asp:Panel ID="mapa" runat="server" style="width:100%; height:100%" align="center" Visible="true">
</asp:Panel>