Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    popup with background disabled

    I need a script to generate a popup when page loads with background disabled. Please help

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    What you mean by "background disabled"?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    basically I need a script for LightBox.
    I googled for the same and got a few scripts but I can only dispaly images with those scripts; not html or any dynamic page content

    My requirement is that
    when a page loads say page.html, i want to show a popup message which is being displayed from another html page say popup.html or from a hidden div tag on page.html, but the contents of page.html should not be accessible unless a user confirms certain details on given on popup window

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,029
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    Most modern browsers block pop-ups.

    Try something like this:-

    Code:
    <div id = "div1" style="visibility:hidden">
    Content of this div
    <br><br>
    </div>
    
    <div id = "div2" style="display:block">
    Enter the correct details here to continue <input type = "text" id = "details" onblur = "showPage()";
    <br><br>
    </div>
    
    <div id = "div3" style="visibility:hidden">
    Content of this div
    </div>
    
    <script type = "text/javascript">
    
    function showPage() {
    if (document.getElementById("details").value = "correct details") {
    document.getElementById("div1").style.visibility = "visible";
    document.getElementById("div3").style.visibility = "visible";
    document.getElementById("div2").style.display = "none";
    }
    }
    
    </script>
    Remember that users with Javascript disabled will not be able to see the page. And of course the "correct details" (in effect the password) will be easily visible with "View Source". You can marginally conceal this by placing your script in an external .js file. But I expect you realise that anything beyond very weak security requires server-side scipting.



    "There is hardly anything in the world that some man cannot make a little worse and sell a little cheaper, and the people who consider price only are this man's lawful prey." John Ruskin
    Last edited by Philip M; 07-16-2009 at 08:07 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •