<type skrip = "Teks/JavaScript">
fungsi toggle () {) {
TheOBJ = document.getElementById ('SUNYANZI').
If (theObj.display == "none") theobj.display = "block";
}
</script>
<div id = "sunyanzi" style = "display: none"> Anda melihat saya muncul ~~~ </div>
<br />
<input type = "Tombol" Onclight = "toggle ()" value = "Coba lihat ...?"
Dua Metode: Hapus dan Sembunyikan
// Buat lapisan pop -up Anda
var dvmsg = document.createElement ("div");
strhtml = "<div class = '####'> konten layer pop </div>" "
Strhtml += "<div class = '####'> <input type = 'Tombol' value = 'Turn off' ontClick = 'btnclick ()'> </div>"
dvmsg.innerhtml = strhtml;
Document.Body.AppendChild (DVMSG);
// tutup tombolnya
btnclick = function () {{
document.body.removechild (DVMSG);
---------------------------
Atau lapisan pop -up ditandai dengan ID div
<Div ID = "Tanchu"> Konten Lapisan Pop -Up </Div>
di JS
fungsi terbuka () {
document.geteLementById (tanchu) .style.display = "" "; // display
}
Fungsi tutup () {) {
document.geteLementById (tanchu) .style.display = "none";
}