【问题标题】:How do I save a div and its contets in ViewState?如何在 ViewState 中保存 div 及其内容?
【发布时间】:2013-05-22 13:43:08
【问题描述】:

我有一个 div,其内容将通过 javascript 填充并返回一个图像,但我的问题是:我有 4 个下拉列表,AutoPostBack=true,它会导致我的 div 的内容消失... 如何保存图像以始终显示?我已经阅读了有关 ViewState 的信息,但无能为力...

这是我的代码:

<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&ma‌​ptype=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&ma‌​ptype=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 更改为 panel,但没有任何改变

       <asp:Panel ID="mapa" runat="server" style="width:100%; height:100%" align="center" Visible="true">
                </asp:Panel>

【问题讨论】:

    标签: javascript vb.net html panel autopostback


    【解决方案1】:

    没关系,去吧!我唯一做的就是检查我的页面是否回传,然后调用我的 javascript!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      • 1970-01-01
      • 2013-03-08
      相关资源
      最近更新 更多