Javascript A simple grayed out overlay

Overlay
One of the most adopted feature of web2.0 is the use of a grayed out overlay panel. Overlay is useful to insert a new page inside the current page..

Almost all the javascript libraries available today comes with the overlay feature inbuilt.

Below is the code snippet for overlay using plain js and html without any libraries.

Code

<HTML>
    <BODY>
The javascript code to display and hide the overlay.
    <script type="text/javascript">
    function disable1() {
    var blurDiv = document.createElement("div");
    blurDiv.id = "blurDiv";
    blurDiv.style.cssText = "position:absolute; top:0; right:0; width:" + screen.width +
    "px; height:" + screen.height +
    "px;background-color: #000000; opacity:0.5; filter:alpha(opacity=50)";
    var aDiv = document.createElement("div");
    aDiv.appendChild(document.createTextNode("Overlay panel"));
    aDiv.id = "aDiv";
    var b1 = document.createElement("<br>");
    var b2 = document.createElement("<br>");
    aDiv.appendChild(b1);
    aDiv.appendChild(b2);
    aDiv.style.cssText = "position:absolute; top:200; right:200; width:" + screen.width / 4 +
    "px; height:" + screen.height / 4 + "px;background-color: #FFFFFF;";
    var bt = document.createElement("input");
    bt.type = "button";
    bt.id = "bt";
    bt.value = "Hide";
    bt.onclick = clear;
    aDiv.appendChild(bt);
    blurDiv.appendChild(aDiv);
    document.getElementsByTagName("body")[0].appendChild(blurDiv);
    }
    function clear() {
    var blurDiv = document.getElementById("blurDiv");
    blurDiv.parentNode.removeChild(blurDiv);
    }
    </script>
    
Here goes the remaining html
    <div class="buttonAlign">
    <table border="0" cellspacing="1" cellpadding="0" align="center" class="sjTable"width="100%">
    <tr>
    <th colspan="2">
    Overlay panel
    </th>
    </tr>
    <tr>
    <td align="left">
    Click on the Show Panel button to open up the overlay panel on this page.
    </td>
    <td align="right">
    <input type="button" name="shoPanel" value="Show Panel" onclick="disable1()"/>
    </td>
    </tr>
    </table>
    </div>
    <div id="myFreezeDiv">
    hi how are you
    </div>
    </BODY>
    </HTML>

Comments

  1. This is working. Good one!

    ReplyDelete

  2. In today's digital age, having a reliable online presence is essential for any business. Many companies turn to various platforms to enhance their visibility and reach their target audience effectively. For those interested in exploring new opportunities, zizodtf.com offers a range of services tailored to meet diverse needs. By leveraging their expertise, businesses can improve their online strategies and achieve greater success.

    ReplyDelete

  3. Gemäß § 64 des neuen DORA-Regulativs müssen Unternehmen ihre Drittanbieter sorgfältig überwachen. Dieser Paragraph hebt hervor, wie wichtig es ist, die Resilienz gegenüber potenziellen Risiken zu gewährleisten. Oft wird angenommen, dass ein einfacher Vertrag mit einem Dienstleister ausreicht. Doch das Gegenteil ist der Fall: Regelmäßige Resilienztests sind unerlässlich, um Schwachstellen zu identifizieren und zu beheben. Zudem sollte man sich auf Anbieter konzentrieren, die hohe Standards in der Cybersecurity bieten, zum Beispiel nach ISO 27001 zertifiziert sind. Eine Weiterbildung in cybersecurity kann hier wertvolle Kenntnisse vermitteln; entsprechende Angebote finden Sie unter https://csvisor.de/. Nur so können Unternehmen wirklich sicherstellen, dass sie gut aufgestellt sind und nicht von unvorhergesehenen Problemen überrascht werden.

    ReplyDelete

Post a Comment

Popular posts from this blog

Log4j multiple WAR files in single EAR configuration

Java NIO2 - Watching a directory for changes. FileWatcherService.

Ubuntu / kubuntu - Laptop key board cursor jumping issue