本文介绍了单击任何服务器控件后,动态添加的div不会保留.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用javascript在按钮单击上添加了div.

I have added div on button click by using javascript.

<script type="text/javascript" language="javascript">

        function createDiv() {
            var divTag = document.createElement("div");

            divTag.id = "div1";

            divTag.setAttribute("align", "center");
             divTag.style.margin = "0px auto";
            divTag.className = "dynamicDiv";

            divTag.innerHTML = "This HTML Div tag created "  + "using Javascript DOM dynamically.";

            document.body.appendChild(divTag);
        }

    </script>



当我单击任何其他服务器控件时,它消失了.



When i click to any other server control, its disappear. how could i remain it.

推荐答案


这篇关于单击任何服务器控件后,动态添加的div不会保留.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 23:54