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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts

    simple javascript help with page onload function and div

    I am actaully trying to load a popup contact form on page load. Also when people click on Contact the form will popup too.
    Div name #cpopup
    when i click the link it loads the popup
    Code:
    <p><a class="contactform" href="#cpopup">Contact</a></p>
    but the problem is that whenever the use function like <body onload="javascriptopupload()"> its not working. Can anybody help me to code that both of them will work. Onload and on click as well.

    Thanks in advance
    Last edited by bijaybd; 04-04-2014 at 06:40 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,982
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    All modern browsers block unrequested popups. That is, those not specifically requested by the user.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts
    here is the code working to load automatically after x seconds -
    Code:
     <script>
    $(function() {
      $("##cpopup").addClass('contactform').delay(2000).fadeIn(500);
    });
    </script>
    but now the page load it self with the results not the popup box. I mean the popup box does not appear at all ?

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,662
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Did you notice the typo in your element selector?

  • #5
    Regular Coder
    Join Date
    Nov 2008
    Posts
    103
    Thanks
    4
    Thanked 0 Times in 0 Posts
    hey thank you for reply. But i solved the issue


  •  

    Posting Permissions

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