問題
如何 使用Javascript產生動態遮罩
解決方法
<script language="javascript"> var docEle = function() { return document.getElementById(arguments[0]) || false; } function showMask() { createMask(); } function hideMask() { var m = "autoMask"; if (docEle(m)) document.removeChild(docEle(m)); } function createMask() { var m = "autoMask"; if (docEle(m)) document.removeChild(docEle(m)); var newDiv = document.createElement("div"); newDiv.id = 'autoMask'; newDiv.style.cssText="zoom: 1;filter: alpha(opacity=50);opacity: 0.5;width: 100%;background-color: Gray;height: 100%;position: absolute;left: 0;top: 0;z-index: 9999999;text-align: center;margin-top: 0px;"; newDiv.innerHTML="<table width='100%'><tr><td style='height: 300px;text-align: center;'><h2>L O A D I N G . . . . . .</h2></td></tr></table>"; document.body.appendChild(newDiv); } </script>
<body> <a href="#" onclick="showMask();">showMask</a> </body>
沒有留言:
張貼留言