< The script type = “text/javascript” > The function toggle () { TheObj = document. GetElementById (’ Sunyanzi). Style; If ( Theobj. display == “none”) theobj. display = “block”; The else theObj. The display = “none”; } < / script> < Div id = “Sunyanzi” style = “display: none” > There I am. / div> < Br / > < Input type=“button” onclick=“toggle()” value=” ?” / >
Two methods: remove and hide
// create your pop-up layer Var dvMsg = document. The createElement method (” div ”); StrHtml = ”< Div class = ’# # # #’ > Pop-up layer content < / div>” StrHtml + = ”< Div class = ’# # # #’ > < Input type=‘button’ value=’ close ‘onclick=‘btnclick()’> < / div>” DvMsg. InnerHTML = strHtml; Document. The body. The appendChild (dvMsg); // close button Btnclick = function () { Document. Body. RemoveChild (dvMsg);
------------------------- Or the pop-up layer is marked with div id
< Div id = “tanchu” > Pop-up layer content < / div>
**In js **The function open () { Document. The getElementById (tanchu). Style. The display = ""; / / show } The function close () { Document. The getElementById (tanchu). Style. The display = “none”; // not displayed (same load when page is initialized) }