•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,383 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,063 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 13984 | Replies: 7
![]() |
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,890
Reputation:
Rep Power: 32
Solved Threads: 109
I use a third party ad server to deliver the advertisements on my site. There are two invocation methods: IFRAME and JavaScript. I currently use the IFRAME method because it allows the full webpage to render independently of the ads ... in other words, without slowing down browser rendering time contacting and downloading images or flash animation from a third party server. I don't want the page content to be delayed being displayed because of a slow ad server or large flash animated ad. However, the JavaScript version is more full featured. Is there a way that I could use the JavaScript version while telling the browser not to execute it until the end? What if I were to include the JavaScript via an external file instead of inline?
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation:
Rep Power: 4
Solved Threads: 19
don't know if this is what you are looking for or if it will help, but if you call a javascript function via the onload event in the body tag, it will not run until the page is fully loaded.
<body onload="doWhatever();">
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 344
Reputation:
Rep Power: 4
Solved Threads: 4
Glad to help the csgal.
Campkev is correct. Here is how I do it.
[PHP]
<html>
<head>
<title>My Web Page</title>
<script type="text/javascript">
function LoadTrigger()
{
alert('This will fire after the page has finished loading.');
}
window.onload = LoadTrigger;
</script>
</head>
<body>
<p>
My Web Page is great!
</p>
</body>
</html>
[/PHP]
Campkev is correct. Here is how I do it.
[PHP]
<html>
<head>
<title>My Web Page</title>
<script type="text/javascript">
function LoadTrigger()
{
alert('This will fire after the page has finished loading.');
}
window.onload = LoadTrigger;
</script>
</head>
<body>
<p>
My Web Page is great!
</p>
</body>
</html>
[/PHP]
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,890
Reputation:
Rep Power: 32
Solved Threads: 109
Thanks, guys. Appreciate the help! I will have to play around with this because my JavaScript code uses document.writes so I need to implement them inline where they belong.
Will work on it and let you guys know!
Will work on it and let you guys know! Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation:
Rep Power: 4
Solved Threads: 3
To ensure the page is loaded before the add is drawn you can use a setTimeout(yourfunction,500) type mechanism in the onLoad.
You can also look at using the html dom to add innerHTML instead of using document.write
This can be done at any time... you could even set up a script that rotates your adds every minute or so (also by manipulating the innerHTML of DOM nodes).
You can also look at using the html dom to add innerHTML instead of using document.write
This can be done at any time... you could even set up a script that rotates your adds every minute or so (also by manipulating the innerHTML of DOM nodes).
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,890
Reputation:
Rep Power: 32
Solved Threads: 109
Because I'm using a third party ad server, I don't have access to the script, itself (such as editing the document.writes). All I can do is call the <script> which is located on a remote server.
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Maybe this will work:
<html>
<head>
<title>My Web Page</title>
<script language="javascript">
function LoadTrigger(){
document.getElementById("AdServer").innerHTML = "<iframe.....></iframe>";
}
window.onload = LoadTrigger;
</script>
</head>
<body>
<!-- Placeholder for the iframe -->
<div id="AdServer"></div>
</body>
</html> Last edited by Ziggy Rocks : Jun 21st, 2007 at 12:29 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- JavaScript execution delay (JavaScript / DHTML / AJAX)
- JavaScript execution delay (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: auto completion of the text box from previous entered values
- Next Thread: video streaming



Linear Mode