I have a working script but it gets executed first after the
page has finished loading all the images (which may take a
while). Since the script is placed in window.onload i
understand it has to wait for the loading to get done.
However, i wish to execute the script BEFORE all the
images had time to get loaded. Is that doable? How?
--
Vänligen
Konrad
---------------------------------------------------
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
Jul 23 '05
16 10152
Random wrote: Richard Cornford wrote: Random wrote: <snip> ... , just put the code at the bottom of the document.
</body> <script> ... </script> </html> <snip>
More predictable results would likely be achieved by avoiding a dependency on browser error-correction, so using valid HTML:-
<script type="text/javascript"> ... </script> </body> </html>
<snip> Intended to relate the basic idea only.
A basic idea expressed in words could only be subject to a consideration
of the worth of the idea, but expressed in code it becomes more concrete
and so subject to technical correction. The idea of putting a script
element in to a context where script elements are not allowed is wrong
and should not go uncorrected.
You'll notice it was very clearly a fragment.
The smaller the fragment the fewer the opportunities for errors. Four
tags, two errors resulting in invalid mark-up, not an encouraging ratio.
As well, if someone grabs code from anywhere and doesn't adapt it to his own needs / desires, he's making his own bed, no?
So does this mean that you expect to be able to post any old nonsense in
response to questions here and consider anyone taking you seriously as
being at fault for taking you seriously?
The nature of your 'basic idea' was that placing javascript code inside
the suggested script elements in the suggested context would represent
the required adaptation.
I shouldn't have posted at all, but Google Groups didn't show me the two preceding posts until I'd already posted mine. Surprise surprise.
Google may have downgraded its Usenet interface to the point where it is
on a par with the very worst available but they cannot be considered
responsible for the fact that Usenet communication is not instantaneous.
It takes time for posts to propagate globally, hours usually, days
sometimes.
Richard.
> be automatically scrolled to the position you were at when you left
This partucular task in your particular case is not possible. Browser
gets image size from width/height attributes of image tag. If these
attributes are not indicated, then browser has to examine each image
header to retrieve the data. Until each image header is received,
browser has no means to know the required offsetTop for the page, so
any scroll operations are pointless.
And just saving your time for another "Super FAQ" post:
- "Can I do for each image <image src=... width="10" height="10"
onLoad="studyIm ageHeaderAndSet RealSize"> "
- No, you cannot.
>> be automatically scrolled to the position you were at when you left This partucular task in your particular case is not possible. Browser gets image size from width/height attributes of image tag. If these attributes are not indicated, then browser has to examine each image header to retrieve the data. Until each image header is received, browser has no means to know the required offsetTop for the page, so any scroll operations are pointless.
Actually, it is very possible (allthough you had no way to
know that since you surely have much more interesting
things to do than checking my page). :)
I actually know for sure the size of all the images since
it's a bunch of comic strips, so in this particular case, it's
fully doable. However, i'll take your words of advice and
"never" attempt a try like that.
Thanks!
--
Vänligen
Konrad
---------------------------------------------------
Sleep - thing used by ineffective people
as a substitute for coffee
Ambition - a poor excuse for not having
enough sense to be lazy
---------------------------------------------------
>> Until each image header is received, browser has no means to know the required offsetTop
after that:
it is very possible
.... as long as the page from cache is still matching the page on your
server.
JRS: In article <11************ *********@g49g2 000cwa.googlegr oups.com>,
dated Fri, 3 Jun 2005 15:01:01, seen in news:comp.lang. javascript,
Random <ra*******@gmai l.com> posted :
For God's sake, Google Groups sucks... it didn't show me the two posts that basically resolved this one.
Don't use it, then; use a proper newsreader.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Richard Cornford wrote, amongst other things: Random wrote: Richard Cornford wrote: Random wrote: <snip> ... , just put the code at the bottom of the document.
</body> <script> ... </script> </html> <snip>
More predictable results would likely be achieved by avoiding a dependency on browser error-correction, so using valid HTML:-
<script type="text/javascript"> ... </script> </body> </html> <snip> Intended to relate the basic idea only. A basic idea expressed in words could only be subject to a consideration of the worth of the idea, but expressed in code it becomes more concrete and so subject to technical correction.
A matter of perspective. I would imagine that an idea is subject to
correction regardless of how it is expressed. Applying differing
standards to differing forms of expression is a personal choice, and it
would be wasted effort to assail such a choice.
I will say that whether words or code, if an expression is very clearly
a fragment then it is also clear that it is not intended to work as-is,
and I at least would think that corrections to make it less of a
fragment (as opposed corrections to the idea that the fragment
illustrates) on the basis that as-is it will not work, are also wasted
effort.
But then again, so is justifying oneself. Since I have no desire to try
to change your mind regarding any of this, I'll leave it at that.
The smaller the fragment the fewer the opportunities for errors. Four tags, two errors resulting in invalid mark-up, not an encouraging ratio.
See above. The degree to which the fragment is or is not fragmentary is
irrelevant when it is clearly intended as a fragment.
As well, if someone grabs code from anywhere and doesn't adapt it to his own needs / desires, he's making his own bed, no?
So does this mean that you expect to be able to post any old nonsense in response to questions here and consider anyone taking you seriously as being at fault for taking you seriously?
Yes and no. Every person is at fault for what they choose or choose not
to do. Every person is responsible for his own actions, and I would no
more consider myself responsible for the consequences of someone
failing to observe what I have made clear than I would for the homeless
man down the road responsibly spending the dollar I have given him.
That said, of course it is hoped that one would make an effort to be
honest and correct, regardless of the forum or medium, and I certainly
do. If I have doubts about whether my code will work, I test it first,
and/or express those doubts in the post so that the reader may be
forewarned. Of course I make mistakes, but humans do that. This was not
one of those mistakes-- responding to your reply was.
Are you saying that you hold other people responsible when you reuse
their code without evaluating it first? It's a rhetorical question. I
have no interest in the answer.
Perhaps a disclaimer at the bottom of every post:
*May not work in all implementations of all levels of the DOM on all
platforms, or of JavaScript or derivative languages, or all versions or
implementations of HTML or similar languages or other any other
document type. The Author is not responsible for damages resulting from
use of the information contained herein, including but not limited to
loss of time, loss of data, and loss of potential income. The
information contained herein is provided as-is, for educational
purposes only, without warranty, express or implied, especially but not
exclusively with regard to useability or merchantability . Some
jurisdictions do not allow implied warranties to be disclaimed, so this
clause may not apply to you. The reader is responsibile for all
consequences of reading this article or post, and for the use or
failure to use the information contained hereing.
The nature of your 'basic idea' was that
.... placing the script at the bottom of the document would allow it to
be executed in the order desired, which is correct. Lo, it works.
I will not make any further attempt to explain myself. If you have
questions or concerns, feel free to approach me with them as questions
or concerns, but a combative approach is unlikely to achieve the
desired result.
Such pendantry has very little innate value in most forums or media.
"Random" <ra*******@gmai l.com> writes: Such pendantry has very little innate value in most forums or media.
I think you are underestimating the complexities of writing for as
heterogenic an environment as "javascript in a browser". No matter
what you do, there is probably some browser somewhere that fails to
understand it correctly. The more you stray from the standards, the
more likely this is. That is why the regulars of this group might
seem pedantic when they recommend against non-valid HTML, and in
particular, when they (or "we" :) correct HTML errors in examples
given as suggested solutions, fragmentary or not. Believe me, it
is not pure pedantry.
Richard Cornford's original correction said nothing more than
that invalid HTML makes it less predictable what browsers will
do, and he gave an example that has the same expected behavior
while being valid HTML. It's hard to do *less* while advocating
valid HTML, which I too think is The Right Thing To Do(tm).
I also recommend reading
<URL:http://diveintomark.or g/archives/2003/05/05/why_we_wont_hel p_you>
/L 'Me thinkst thou doest protest too much'
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.' This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian |
last post by:
Hi everyone,
I'm writing a function (in javascript) that needs to do one thing if
the page has not loaded, and another (different) thing if the page has
already loaded.
I'm looking for a way to tell if the window.onload event has already
fired. I cannot edit the onload event handler itself, and my function
can only exist in an external js file, sourced from the document's
head section. Any ideas?
|
by: Jenny |
last post by:
In the code below, I can write html content var t='<body
BGCOLOR=blue>'
for a new window. But if it contains javascript, such as var
t='<body onload="window.open('new1.html')">', this code will not work.
Could you confirm this and find such syntax rule for me on the
internet? Thank a lot.
<html><head>
</head><body>
<SCRIPT language=JavaScript>
|
by: jadiyo |
last post by:
Hi,
I've read many questions about how to automatically open a new window
from a page using the JavaScript onLoad command.
Unfortunately, due to the web application framework being used
(WebLogic Portal 7), I can not use it as it is already being used and
is only called once by the browser(so I believe).
What I am essentially trying to do is open a "Please wait, this may
|
by: Liming |
last post by:
Hi,
Here is my situation. I have a textarea on the page. When the page
loads, I need it to have some default text (which will be generated
dynamically)
so I did something like this
function init()
{
|
by: Frances |
last post by:
I have three functions I need triggered when page loads, so have
<body onload="function1();function2();function3()">
but I want to take all these function calls out of body tag and call
them in header, thus:
window.onload=function1;function2;
but I just realized that only first function in this list gets called
| |
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 somewhere
except within the body tag, or must it always be in the body tag?
For example, if this is placed elsewhere ...
window.onload(something())
|
by: Daz |
last post by:
Hello everyone,
I would like to open a child window from the parent, and add an onload
event listener to the child window which will tell the parent when the
document has loaded. As far as I know, this shouldn't be an issue, but
I just can't get it to work. The script only needs to work with
Firefox/Mozilla, so XP code isn't an issue.
I have tried to open a window like so.
|
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 (i=0;i<obj.length;i++) {
obj.attachEvent('ondrag', noDrag);
}
|
by: lilOlMe |
last post by:
Hi there!
I'm developing some crazy Tab Control in .NET that uses JavaScript.
A particular JavaScript method needs to be called during the window.onload event in order to initialize my Tab Control.
The thing is that there can be more than one Tab Control on the page....and each one must be initialized during the window.onload event.
Adding the JavaScript function call responsible for initializing a particular Tab Control to the...
|
by: Beni Rose |
last post by:
I'm trying to open a new window using window.open and then print that
window once it's loaded. It works fine in Firefox, but not at all in
IE. No matter what I put in my onload, it gets ignored. Here's the
code:
function openPrintPage(loc)
{
var printWin = window.open(loc+'?
dl=false','printpage','width=600,height=800,location=no,menubar=no,directories=no,status=no,toolbar=no,scrollbars=yes,resizable=yes');
printWin.onload = function()
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |