您好,登錄后才能下訂單哦!
<title>折疊菜單</title> <script type="text/javascript" src="dtree.js"></script> </head> <script type="text/javascript"> //dtree 目錄樹(shù)結(jié)構(gòu) var d = new dTree("d"); d.add(0,-1,"根目錄"); d.add(1,0,"一級(jí)目錄1"); d.add(2,0,"一級(jí)目錄2"); d.add(3,0,"一級(jí)目錄3"); d.add(4,0,"一級(jí)目錄4"); d.add(5,2,"二級(jí)目錄2"); d.add(6,4,"二級(jí)目錄4"); d.add(7,4,"二級(jí)目錄4"); d.add(8,7,"三級(jí)目錄4"); d.add(9,8,"demo站點(diǎn) 登陸鎖屏效果","demo.html"); document.write(d); </script> <body> <br /> <a href="javascript:d.openAll()">展開(kāi)全部</a> || <a href="javascript:d.closeAll()">折疊全部</a> </body> <title>登陸鎖屏效果</title> </head> <script type="text/javascript"> function sAlert(str){ //alert(str); //創(chuàng)建遮罩層 var bgObj = document.createElement("div"); bgObj.id = "div1"; bgObj.style.position = "absolute"; //定位 bgObj.style.top = "0"; //距離頂部的距離 bgObj.style.left = "0"; //距離左邊的距離 ,與上面2行一起完成全屏遮罩 bgObj.style.border = "1px solid #f00"; //邊框 bgObj.style.background = "#44eeff"; //背景色 //bgObj.style.width = "100%"; //寬度的另一種表示方式 bgObj.style.width = document.body.offsetWidth+"px"; //bgObj.style.height = "100%"; //高度的另一種表示方式 bgObj.style.height = screen.height+"px"; //alert(bgObj.style.width); //alert(bgObj.style.height); bgObj.style.opacity = "0.1"; //IE9 firefox 下的透明度設(shè)置 bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75)"; // ie 低版本下的代碼 bgObj.style.zIndex = 1000; // 層的堆疊順序,序號(hào)大的,就堆疊在上面 document.body.appendChild(bgObj); //創(chuàng)建彈窗框 var mObj = document.createElement("div"); //alert(mObj); mObj.id = "div2"; //邊框 大小 mObj.style.border = "1px solid #ff0000"; mObj.style.width = "450px"; mObj.style.height = "250px"; mObj.style.background = "#efefef"; //定位 mObj.style.position = "absolute"; mObj.style.top = "35%"; mObj.style.left = "30%"; //堆疊順序 mObj.style.zIndex = 1001; document.body.appendChild(mObj); //添加消息層 -- 關(guān)閉按鈕執(zhí)行動(dòng)作層 var title = document.createElement("h4"); title.id = "title"; title.align = "right"; title.innerHTML = "關(guān)閉"; title.style.border = "1px solid #dfdffd"; title.style.background = "#c5c5c5"; title.style.margin = "0"; //定位距離消息框頂部的距離 title.onclick = function(){ //alert(11212); document.body.removeChild(bgObj); //先刪除背景遮罩層對(duì)象 mObj.removeChild(title); // 再刪除本消息層對(duì)象 document.body.removeChild(mObj); //最后刪除彈窗框?qū)ο? } mObj.appendChild(title); //最后子啊消息層里添加頁(yè)面內(nèi)容 var pInfo = document.createElement("p"); pInfo.align = "center"; //添加內(nèi)容 pInfo.innerHTML = "這里是你的網(wǎng)頁(yè)代碼<br /><br />"; pInfo.innerHTML += "用戶名:<input type='text' name='username'><br />"; pInfo.innerHTML += "密 碼:<input type='password' name='password'><br /><br />"; pInfo.innerHTML += "<input type='submit' name='submit' value='體交唄'>"; mObj.appendChild(pInfo); } </script> <body> 這里是JS 登陸效果的DEMO 頁(yè)面<br /> <h4><a >點(diǎn)我百度一下</a></h4><br /> <input type="button" value="打開(kāi)遮罩層后就不能點(diǎn)擊了" onclick="sAlert('測(cè)試彈出框并加上鎖屏效果')" /><br /><br /> <a href="index.html">返回首頁(yè)</a> </body>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。