472,354 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

<img> onload vs complete

Hi everybody,

I'm using the event "onload" to trigger a function when an
image has been preloaded. But it seems to me that the
function is triggered right at the beginning of the transfer
from remote to local rather than at the end of it.

Can anybody confirm this?

Thank you.

Manu

Jul 31 '06 #1
4 4105
http://www.w3schools.com/jsref/jsref_onload.asp

has your information. Don't you love W3Schools ? :)

If you have troubles running your code, I suggest one of the following
:

1) verify if you have errors using alert debug windows and such (i.e. :
alert( var_to_test );)

2) use setTimeout() to delay the execution of the code

3) employ this to wrap your JS inside the <imgevent attribute :

<img src="blah.gif" onload="//<![CDATA[
/** some js code here **/
//]]>" />

Read about it here : http://en.wikipedia.org/wiki/CDATA

But frankly, good coding rarely make it to solution 2) as it should run
correctly in solution 1).

Hope this helps.

Jul 31 '06 #2
Yanick wrote:
http://www.w3schools.com/jsref/jsref_onload.asp

has your information. Don't you love W3Schools ? :)
Yes; partial information and falsehoods put across as if it was
definitive.

<snip>
3) employ this to wrap your JS inside the <imgevent attribute :

<img src="blah.gif" onload="//<![CDATA[
/** some js code here **/
//]]>" />
When you have absolutely no idea why you are recommending something it
would probably be better not to mention it at all. This is a mystical
incantation, and can achieve nothing.
Read about it here : http://en.wikipedia.org/wiki/CDATA
<snip>

A page that never suggests the above nonsense, or even implies anything
about it.

Richard.

Jul 31 '06 #3
Richard wrote:
Yanick wrote:
http://www.w3schools.com/jsref/jsref_onload.asp

has your information. Don't you love W3Schools ? :)

Yes; partial information and falsehoods put across as if it was
definitive.

<snip>
>3) employ this to wrap your JS inside the <imgevent attribute :

<img src="blah.gif" onload="//<![CDATA[
/** some js code here **/
//]]>" />

When you have absolutely no idea why you are recommending something it
would probably be better not to mention it at all. This is a mystical
incantation, and can achieve nothing.
Using CDATA is not a 'mystical incantation' when used as required by
the XML application to set aside parsing the CDATA content.
>
>Read about it here : http://en.wikipedia.org/wiki/CDATA
<snip>

A page that never suggests the above nonsense, or even implies anything
about it.
Well. it does mention
'The term indicates that a certain portion of the document
is general character data, rather than non-character data or character
data with a more specific, limited structure.'
In some XML applications, the idea of 'general character data' is exploited
to hide an inline script from the operations that deal with figuring out the
rest of the XML user code.

For example:

....
<Script DEF='OpenVault'>
....
<![CDATA[ ecmascript:
function combinationEntered (value) {
unlocked = value;
}
function openVault(value) {
if (unlocked) vaultUnlocked = value;
}
]]>
</Script>

http://www.web3d.org/x3d/specificati...riptingExample

This is the special case of a Script node in a specific XML application that
also generally applies to inline script handling in XHTML tools.
>
Richard.
Fortunately, in that application, like others, there is a way to get rid of
the
CDATA or equivalent wrapper. Instead, just include the url to the script
location.

Thanks and Best Regards,
Joe
Jul 31 '06 #4
Joe D Williams wrote:
>Richard Cornford wrote:
>>Yanick wrote:
<snip>
>>3) employ this to wrap your JS inside the <imgevent attribute :

<img src="blah.gif" onload="//<![CDATA[
/** some js code here **/
//]]>" />

When you have absolutely no idea why you are recommending
something it would probably be better not to mention it at
all. This is a mystical incantation, and can achieve nothing.

Using CDATA is not a 'mystical incantation' when used as required
by the XML application to set aside parsing the CDATA content.
<snip>

Which is irrelevant to placing CDATA style mark-up inside the value of
an intrinsic event attribute in either HTML or XHTML. In neither case
could that CDATA style mark-up ever be interpreted as declaring CDATA,
and the result only avoids being a syntax error by being the text of
comments. Given that, the above most certainly is a mystical
incantation; it does precisely nothing in reality and is only being
'used' (rather than being weeded out as an obvious error) because it
does precisely nothing in reality.

Richard.
Jul 31 '06 #5

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

Similar topics

15
by: Philipp Lenssen | last post by:
My friend has the following problem (background: we want to transform XML to XHTML via XSLT): "We copy XHTML fragments into an output by using the following template: <xsl:template match="*"...
5
by: MyndPhlyp | last post by:
I've been busting my head trying to figure this out for quite some time. With IE6 and NS7, no problems. I can simply code the HTML <img height="100%"> and be done with it. But NS4 and NS6 (and...
4
by: Luke Venediger | last post by:
Hi there, Please help. I cannot get a javascript function to be called from an img tag when the page loads. Here is a snippet of my code, and I'm trying to call the MM_nbGroup function, but this...
15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and <img src="/ImageFilename.png" style="width:...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
1
by: Carl | last post by:
Hi all I have a javascript function that drags and drops an element (ie img) into a container (ie bordered div). The function works and returns the element and and container. My next step is to...
4
by: bgold12 | last post by:
Hey, I've come across a strange behaviour that shows itself in IE 7.0 and Firefox 3 and probably other browsers. In the code below, which is a complete HTML document which validates as XHTML 1.0...
2
by: Sven Reuter | last post by:
Puzzled wrote: I hope I'll understand it in the right way. You browse your website http://www.example.com with a webbrowser. In the source of it is written by PHP <img...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.