Results 1 to 2 of 2

Thread: Help with Javascript Pop Up

  1. #1
    Join Date
    Apr 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with Javascript Pop Up

    Hi There,

    This is my first post here and its a cry for help! I have a programmer but he is unable to get this to work at he does not specialise in Java Script.

    I have a POG here:

    <!-- POG START -->
    <script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/0228a9e9b3.js"></script>
    <script language="javascript" type="text/javascript">setTimeout("self.focus()", 15000);</script>
    <!-- POG END -->

    I have this on my video site which is powered my wordpress. I have placed this on the single.php page and whenever someone goes to one of the single pages it pops up and asks them a yes or no question.

    What I need is to delay this script from coming up to give the visitor time to view the page and start watching videos on the site lets say 30 seconds and then this pops up.

    The java script is from an external site.

    Is there anyone that would know how to do this?

    Any help would be appreciated. I am not that familiar with Java Script.

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    From your posting it seems that the JS file inclusion that you've done from another website is triggering a popup in your page and you want to avoid that for at least 30 seconds, so that the users can view your page.

    The problem here is the way you've included the JS file from the website. If that JS file has any instruction which is outside any function the file has then those will be executed as and when the JS script engine encounters those lines.

    The solution I propose is adding this script element at run-time (dynamically) using JS script from your page after 30 seconds so that the user will be able to view your page

    You can avoid your script inclusion line

    Code:
    <script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/0228a9e9b3.js"></script>
    And add the following code in your <head> section
    Code:
    <script type="text/javascript">
    window.onload = function(){
    	setTimeout(function(){
    		var newScript = document.createElement('script');
    		newScript.type = 'text/javascript';
    		newScript.src = 'http://prompt.zangocash.com/pog/0228a9e9b3.js';
    		document.getElementsByTagName("head")[0].appendChild(newScript);
    	},30000);
    }
    </script>
    The above section will include the JS file from the website you've mentioned dynamically after 30 seconds the window loads your page.

    It is always better if you post a link to your page so that forum users can have a look at it and experience the problem(s).
    Last edited by codeexploiter; 04-02-2008 at 04:03 AM. Reason: corrections

Bookmarks

Posting Permissions

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