473,396 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Simple onload for my js.file

I am trying figure out how to add body onload for external js file.
All the examples i found are more than i what i need.

Any help would be appreciated.
Mar 19 '08 #1
3 1312
"Nody" wrote:
>I am trying figure out how to add body onload for external js file.
All the examples i found are more than i what i need.
<HTML>
<HEAD>
...
<SCRIPT src="YourScriptFile.js" type="text/javascript"></SCRIPT>
</HEAD>
<BODY onload="initialize()"// where function initialize() must be defined
in YourScriptFile
...
</BODY>
</HTML>

Tom
Mar 19 '08 #2
On Mar 19, 3:40 am, "Tom de Neef" <tden...@qolor.nlwrote:
"Nody" wrote:
I am trying figure out how to add bodyonloadfor external js file.
All the examples i found are more than i what i need.

<HTML>
<HEAD>
...
<SCRIPT src="YourScriptFile.js" type="text/javascript"></SCRIPT>
</HEAD>
<BODYonload="initialize()"// where function initialize() must be defined
in YourScriptFile
...
</BODY>
</HTML>

Tom
I cannot alter the java script. How can i get the page to load first
and then execute the script. Maybe some type of delay method.

Many Thanks
Mar 19 '08 #3
"Nody" wrote:
>
I cannot alter the java script. How can i get the page to load first
and then execute the script. Maybe some type of delay method.
I think that your js file will be loaded as part of the loading of the htm.
That may result in the initialization of global variables - I guess you can
not stop that.
You can change the onload call of <bodyso that your own function is
executed rather than the original one. In that own function you would have
to mess around with a timer which calls the original function. But I do not
know enough about timers to judge if this can achieve your goal.
Tom
Mar 20 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raphael Gluck | last post by:
Hi Everyone Just a simple question If i have more than one Javascript in the head tag, and both have a body Onload how do i write the opening body tag? do i enter two Onloads? This didnt work for...
10
by: berg | last post by:
I'm trying to use the onload event to load a series of urls. What I find is that the onload function is only called one time no matter how large the array. Here is the onload function. var...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
3
by: vezquex | last post by:
What I want is an element with a shifting background image: <html><head> <script type="text/javascript"> var x = 0 var y = 0 inc = 4 function bgWander(el){ x = x +...
5
by: amit | last post by:
Hello, the javascript I'm using is not embedded into HTML but included. When I looking at w3schools.com it uses examples with js embedded into html. Anyway, when I use: function load() {...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
1
by: zebra242 | last post by:
I'm working to get the onLoad function of a javascript to work: the script allows form buttons in html to refer to labeled frames in flash. Which works fine. Now I want to add onLoad...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.