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

Firefox and <body onload=.. > firing after page is rendered

Hi All,

I have some initialization to be done at page load time, which changes
the text of some anchors so that they are consistent with the query
string (these anchors are used as criteria selectors, and should be
initialized to the criteria contained within the url).

IE and Safari fire the onload event before rendering any elements, so
when the event handler synchronizes the anchors, they are rendered with
the right contents immediately. Firefox, though, renders the page
first, and then fires the handler, which results in the anchors getting
their initial values, and then changing to proper selections. I've
tried calling my init() method immediately after the anchors are
defined in my document - no difference, looks like Firefox is rendering
everything as soon as it's encountered in the document.

Is there any way to have my code run before any elements are rendered
in Firefox? Currently I've "solved" this by hiding the containing div
in the document, and showing it after making changes. This results in
the UI visually reloading itself with each new page, which is not very
desirable either.

Aug 16 '05 #1
3 3827
ASM
us****@ctoxyeb.com wrote:
Hi All,

I have some initialization to be done at page load time, which changes
the text of some anchors so that they are consistent with the query
string (these anchors are used as criteria selectors, and should be
initialized to the criteria contained within the url).
once more I do understand anything

What is the text of an anchor ? (no sense for me)
What do you call an 'anchor' ? is it a 'tag' ?
looks like Firefox is rendering
everything as soon as it's encountered in the document.
usually it's the way of doing with IE (Mac ?)
Is there any way to have my code run before any elements are rendered
in Firefox?
what kind of code do you use to re-render your anchors ?
(don't more know what you mean)
Currently I've "solved" this by hiding the containing div
in the document, and showing it after making changes. This results in
the UI visually reloading itself with each new page, which is not very
desirable either.


why don't you send the right code insteed to re-write it on the fly ?
--
Stephane Moriaux et son [moins] vieux Mac
Aug 16 '05 #2

ASM wrote:
us****@ctoxyeb.com wrote:
Hi All,

I have some initialization to be done at page load time, which changes
the text of some anchors so that they are consistent with the query
string (these anchors are used as criteria selectors, and should be
initialized to the criteria contained within the url).
once more I do understand anything

What is the text of an anchor ? (no sense for me)
What do you call an 'anchor' ? is it a 'tag' ?


It's a regular <a> tag, when clicked it opens a selector box, and once
a selection is made, the link text is changed to the selected item.
looks like Firefox is rendering
everything as soon as it's encountered in the document.


usually it's the way of doing with IE (Mac ?)


I've actually checked, IE delays rendering the page until everything is
parsed and onload() is called before rendering.
Is there any way to have my code run before any elements are rendered
in Firefox?
what kind of code do you use to re-render your anchors ?
(don't more know what you mean)


Standard stuff like:

var div = getElementById('divId');
div.innerHTML = newText;

Html for this is along hte lines of:

<a href="#" onclick="openSelector(); return false">
<div id=divId>Selection</div></a>

Once a selection is made, "Selection" gets replaced with the actual
item.

None of this actually matters, though - the problem is that at the time
of unload() the page is already rendered. This is easily seen using
<body onload='alert("onload");'> - in FF, the dialog box is displayed
with the page contents rendered, while in IE/Safari it's displayed over
an empty page, and it's rendered after you click OK.
Currently I've "solved" this by hiding the containing div
in the document, and showing it after making changes. This results in
the UI visually reloading itself with each new page, which is not very
desirable either.


why don't you send the right code insteed to re-write it on the fly ?


Because this is all done client-side, and I'd like to keep it that way
to avoid unnecessary server load.

Aug 16 '05 #3
ASM
us****@ctoxyeb.com wrote:
ASM wrote:
us****@ctoxyeb.com wrote:
Hi All,

I have some initialization to be done at page load time, which changes
the text of some anchors so that they are consistent with the query
string (these anchors are used as criteria selectors, and should be
initialized to the criteria contained within the url).
once more I do understand anything
re-reading (with lighting bellow)
I understand you want to change content of divs (or links)
with what follow an url ( foo.htm?criter1=New text&criter2=Other text )

Couldn't you have a script in header's top
to stock this criterias in global variables

then along lines with links to modify
have JS script(s) to write the correct text(s) comming from this variables ?
What is the text of an anchor ? (no sense for me)


It's a regular <a> tag,


well, we talk about same thing
but, in fact, probably you speak about links
when clicked it opens a selector box,
I don't know what it is in JavaScript
and once
a selection is made, the link text is changed to the selected item.
let's say so
what kind of code do you use to re-render your anchors ?


Standard stuff like:

var div = getElementById('divId');
div.innerHTML = newText;

Html for this is along hte lines of:

<a href="#" onclick="openSelector(); return false">
<div id=divId>Selection</div></a>


<a id="divId" href="#" onclick="openSelector(); return false">
Selection</a>

or, if possible (global variable in header)

<a href="#" onclick="openSelector(); return false">
<script type="text/javascript">document.write(criter_1)</script></a>

because I've seen openSelector() is a Java function
http://onesearch.sun.com/search/ones...Selector%28%29

Are you using Java ?
If yes, I can do anything for you, sorry.
Once a selection is made, "Selection" gets replaced with the actual
item.
Not too hard to do (I think) even if I don't understand what it wiil
do with the NewSelectionText on next click on this link ...
None of this actually matters, though - the problem is that at the time
of unload()
*on*load I presume
the page is already rendered. This is easily seen using
<body onload='alert("onload");'> - in FF, the dialog box is displayed
with the page contents rendered, while in IE/Safari it's displayed over
an empty page, and it's rendered after you click OK.


I see.
Currently I've "solved" this by hiding the containing div
in the document, and showing it after making changes.


If you can't start the job before end of load
I do not see how to do other way

--
Stephane Moriaux et son [moins] vieux Mac
Aug 16 '05 #4

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

Similar topics

2
by: ryan.mclean | last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question is why won't this work? I must be doing something dumb . . . here is the code: in the body tag, I have this code (just to...
1
by: Dung Ping | last post by:
For instance, one set is: <body onload="blinking_header()" onunload="stoptimer()"> Another set is: <body onload="writemsg()" onunload="stoptimer()"> They represent two functions. How to...
9
by: bmgz | last post by:
I need to execute a JavaScript function "onload". The only problem is I don not have access to the <body> tag as it is a part of the standard page-header include (a separate file). How could I have...
5
by: SteveS | last post by:
Hello, I'm having trouble figuring out how to dynamically add an onload and resize event to the <body> tag. I've looked on the web and in MS documentation unsuccessfuly. Does anyone know the code...
7
by: Calvin KD | last post by:
Hi everyone, Has someone out there experienced the same problem? What i wanted to do is to display a popup window (modal) upon the loading of a webpage. Here is my code sample (in html view):...
1
by: lwhitb1 | last post by:
I have been trying to load a javascript function from the body onload html tag, but I only want the function to load the first time the page is loaded: I have investigated but haven't found...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
5
by: tuxedo | last post by:
The way the <body onload="something()"works ensures that the complete html document is loaded before something() is executed. Can the same be achieved when placing the onload call in document...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.