View Full Version : Help with Javascript Pop Up

04-01-2008, 10:50 PM
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.

04-02-2008, 03:59 AM
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

<script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/0228a9e9b3.js"></script>

And add the following code in your <head> section

<script type="text/javascript">
window.onload = function(){
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'http://prompt.zangocash.com/pog/0228a9e9b3.js';

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).