private_guy Posted September 9, 2007 Share Posted September 9, 2007 Hi there, I'm trying to add a timeout to the below JavaScript from Zango but its not working. Here is the orginal source: <html> <!-- POG START --> <script type="text/javascript" language="javascript" src="http://prompt.zangocash.com/pog/0121a9eeb5.js"></script> <script language="javascript" type="text/javascript">self.focus();</script> <!-- POG END --> </html> And I tried to mess with the scr code and added timeout which looks like this: <html> <!-- POG START --> <script type="text/javascript" language="javascript" src="setTimeout(http://prompt.zangocash.com/pog/0121a9eeb5.js)3000"></script> <script language="javascript" type="text/javascript">self.focus();</script> <!-- POG END --> </html> But didn't work, How can I put a timeout script on this? Many Thanks. Best Regards, Jay Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 11, 2007 Author Share Posted September 11, 2007 Anybody ? Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 24, 2007 Author Share Posted September 24, 2007 Can anybody help me, its really important Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 24, 2007 Share Posted September 24, 2007 Why are you trying to delay the loading of the Javascript? Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 28, 2007 Author Share Posted September 28, 2007 So it loads the advert way after loading the Style of my script because if it does it instantly it will ruin the header and style Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 28, 2007 Share Posted September 28, 2007 You could add an event handler to the page's onload function. In the onload event handler, use the DOM to create a script element and set the appropriate .js url. I have no idea if that'd work though. Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 28, 2007 Author Share Posted September 28, 2007 Well we could try this method if its possible: <TIMEOUT CODE HERE> <?php include("Advertisement.JavaScript.php") ?> Which means it does a timeout on when to disply that page so I could just put the code in Advertisement.JavaScript.php Thanks. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 28, 2007 Share Posted September 28, 2007 No, you can't do that. PHP executes on the server before anything is sent to the browser. The timeout has to occur on the client. But I have to wonder if theres not a different way to solve your problem. It seems odd that the advertising script would mess up your layout. Are you sure you're using it correctly? Quote Link to comment Share on other sites More sharing options...
nogray Posted September 28, 2007 Share Posted September 28, 2007 You can do something like this instead <script language="javascript"> function LoadScript(url){ var e = document.createElement("script"); e.src = url; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); } setTimeout("LoadScript('http://prompt.zangocash.com/pog/0121a9eeb5.js')", 3000); </script> This will load the script after 3 seconds. Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 29, 2007 Author Share Posted September 29, 2007 There is no Self.Focus in that code, so I dont think it will work, I will test it now. Hmm.. Well I cant think of another way, Yes it messes up my Layout because if it loads before, the boarder should change White to show, but it doesn't. If you have a fast connection, its no problem, but if you have a slow connection, it will mess up the boarder. Thanks Quote Link to comment Share on other sites More sharing options...
private_guy Posted September 29, 2007 Author Share Posted September 29, 2007 Nope, just tested the script. Please let me remind you that the javascript in an in popup window which shows on the same page. It cant get redirected to that Javascript "JS", it has to open in the same window. So self focus is needed I think lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.