Home >Web Front-end >JS Tutorial >Use js to close the window of the js pop-up layer_javascript skills

Use js to close the window of the js pop-up layer_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:00:551181browse





Two methods: remove and hide

//Create your pop-up layer
var dvMsg = document.createElement("div");
strHtml = "

Pop-up layer content"
strHtml = "
"
dvMsg.innerHTML = strHtml;
document.body.appendChild(dvMsg);
//Close button
btnclick = function (){ ld(dvMsg);

-------------------------


or the popup layer is marked with div id

Pop-up layer content

js
function open(){
document.getElementById(tanchu).style.display=""; //Display
}
function close() {
document.getElementById(tanchu).style.display="none"; //Does not display (load again when the page is initialized)
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn