function toggle() {
theObj = document.getElementById('Sunyanzi').style;
if ( theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
}
你看我出现了~~~
两种方法:去除和隐藏
//创建你的弹出层
var dvMsg = document.createElement("div");
strHtml = "
弹出层内容
"
strHtml += "
dvMsg.innerHTML = strHtml;
document.body.appendChild(dvMsg);
// 关闭按钮
btnclick = function (){
document.body.removeChild(dvMsg);
-------------------------
或者 弹出层用div id标记
弹出层内容
js里function open(){
document.getElementById(tanchu).style.display=""; //显示
}
function close(){
document.getElementById(tanchu).style.display="none"; //不显示(页面初始化的时候同样加载一遍)
}