Hi What is the best way to display a div element when someone visits the page, but if they click "Close" it hides it? I want it like an overlay thanks
have an absolutly positioned (with css) div on top of everything with top:0px; left:0px; width:100%; height:100%; position:absolute; and give it an ID (id="overlay") Then have your link or button call a javascript function document.getElementById("overlay").style.display = "none";
First make a div after body tag <div id="overlayDiv" style="top:0px; left:0px; width:100%; height:100%; position:absolute;"> My contents here <a href="#" onclick="toggleDiv('close')">Close</a> </div>] Code (markup): Now here is javascript function, <script> function toggleDiv(display) { obj = document.getElementById("overlayDiv"); if(display == "open") obj.style.display == "block"; else if((display == "close") obj.style.display == "none"; } </script> Code (markup): I have not tested it, but it should work fine. If not let me know.