473,386 Members | 1,698 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,386 software developers and data experts.

Sequence of Loading

I have a number of sources of javascript and don't really know the
sequence of when each gets loaded.

<SCRIPT FOR="window" EVENT="onLoad">
var tmp = "where are you";
</script>

<script language="JavaScript">
alert(tmp);
</script>

<script language="JavaScript" src="code.js"></script>

Are they loaded based on the order they are seen in the page?

Aug 31 '05 #1
7 2258
pk
<Excerpt from the HTML 4 specification>

--------------
18.2.4 Dynamic modification of documents

1. All SCRIPT elements are evaluated in order as the document is loaded
--------------

Aug 31 '05 #2
<SCRIPT FOR="window" EVENT="onLoad">
var tmp = "where are you";
</script>

Apparently this does not load until after the document has finished
loading, correct?

Aug 31 '05 #3
pk
I believe so, and I could be way wrong since I don't work with
JavaScript and the only reason I found myself in this newsgroup was
because I had questions of my own. :) With that said,

"The onload event occurs when the user agent finishes loading a window
or all frames within a FRAMESET. This attribute may be used with BODY
and FRAMESET elements. "

My guess is that while you wouldn't see the effects of that particular
javascript section until the window or all the frames finished loading,
the code would still be processed first.

Someone who knows should definitely comment though...

-pk

Aug 31 '05 #4
pk
It seems to me (now that I actually read your code to see what you're
trying to accomplish), that the code as you have it now would put out
an alert with the tmp variable which presumably holds garbage at this
point. Then as the page finishes loading, it loads what you wish for
it to print in the variable tmp, but never prints the alert again.

Why do you have the delay on loading the string into the tmp variable?

Aug 31 '05 #5
mike wrote on 31 aug 2005 in comp.lang.javascript:
<SCRIPT FOR="window" EVENT="onLoad">
var tmp = "where are you";
</script>

Apparently this does not load until after the document has finished
loading, correct?


loading and executing are not the same thing.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Aug 31 '05 #6
Reason for the question is I am applying an xml and xsl transformation
so I wait for the document to be loaded before transforming it and
rendering it in a <div id="stuff"></div> using something like
stuff.innerHTML = src.transformNode(sf); where src is the xml and sf is
the xsl stylesheet.

Another Reason is i had some code in a external file like: <script
language="JavaScript" src="code.js"></script> and I had a button with
an onclick event that called a function in that external file. It
produced an error when I clicked the button, but when I put that
function embedded in the document like:
<script language="JavaScript">
function test(){}
</script>
then it ceased to produce the error and longer.

Aug 31 '05 #7
mike wrote:
I have a number of sources of javascript and don't really know the
sequence of when each gets loaded.

<SCRIPT FOR="window" EVENT="onLoad">
var tmp = "where are you";
</script>


It may be useful to know that for..event is IE only.

[...]

--
Rob
Sep 1 '05 #8

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

Similar topics

1
by: CST | last post by:
Hi All, I have a "Digital Dashboard" that basically has 4 IFrame sections. The page flows in the following order: Messages, Stocks, Weather, User Links. Please note that this order needs to...
5
by: Paul | last post by:
The problem I am having involves the sequence of events between frames in an html page. The Pages: Page A has an imbedded IFrame which displays Page B. Page A has a radio button which on...
0
by: sophocles the wise | last post by:
automatically post data & click buttons on sequence of web pages with AxWebBrowser Hi, I need to post stuff everyday to a website and am working on a VB program to do this for me. I am a...
1
by: ltnats | last post by:
Hi there, I have C# Windows Forms app I am building that has a Splash Screen and 4 other forms that are to be shown in different sequences depending on what sequence buttons on the forms are...
4
by: bboyle18 | last post by:
Hi, I am working with a table sorting script which can be found here http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting This script works very nicely, but when there is a...
1
by: (PeteCresswell) | last post by:
I'm loading a TreeView control from a recordset that's sequenced by a date. When I step through the code, I *think* I'm seeing the nodes created in the expected sequence. Problem is, when the...
5
by: zgh1970 | last post by:
Hi, We have some tables with db2 generated field. How can I find the next generated sequence fot those fields. Thanks,
4
by: beertje | last post by:
This is a very newbie question for my first post, perhaps appropriately. I want to print '....' gradually, as a progress indicator. I have a for-loop that every 10 steps executes: print '.', ...
0
by: rval | last post by:
I have this schema while teh following sequence <complexType name="SetOfTasks" mixed="true"> <sequence> <choice minOccurs="1" maxOccurs="unbounded"> <element minOccurs="0"...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.