473,327 Members | 2,065 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,327 software developers and data experts.

OnLoad events on elements other than BODY ?

Hya,

Is it possible to have onload events on elements other than the body
tag ?

Thanks in advance,
Maria

Jun 27 '07 #1
6 19760
wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the body
tag ?
<img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'
>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '07 #2
On Jun 27, 7:17 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the body
tag ?

<img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Does this only work for image elements?
I tried it on a div element and nothing :(
Jun 27 '07 #3
wrote on 27 jun 2007 in comp.lang.javascript:
On Jun 27, 7:17 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
> wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the body
tag ?

<img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'
[please do not quote signatures, a good newsreader will skip them for you]
Does this only work for image elements?
That was not your first Q, that needed only 1 affirmative example.
I tried it on a div element and nothing :(
What would be the logic or the use?

It is not the loading of an element that is flagged,
but the loading of external data by that element.
And <divhas none.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 27 '07 #4
On Jun 27, 8:59 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 27 jun 2007 in comp.lang.javascript:
On Jun 27, 7:17 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the body
tag ?
<img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'

[please do not quote signatures, a good newsreader will skip them for you]
Does this only work for image elements?

That was not your first Q, that needed only 1 affirmative example.
I tried it on a div element and nothing :(

What would be the logic or the use?

It is not the loading of an element that is flagged,
but the loading of external data by that element.
And <divhas none.
what's a newsreader? what's a good newsreader? (I am using the google
groups webpage.)

regarding the topic;
I am trying to call a method which calls a number of further methods
upon some event. At the moment I have a <script... </scriptinside
my html code which calls this function. So I am trying to remove the
script from the html and place it somewhere more appropriate.

Jun 28 '07 #5
wrote on 28 jun 2007 in comp.lang.javascript:
On Jun 27, 8:59 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
> wrote on 27 jun 2007 in comp.lang.javascript:
On Jun 27, 7:17 pm, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the
body tag ?
><img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'

[please do not quote signatures, a good newsreader will skip them for
you]
what's a newsreader? what's a good newsreader? (I am using the google
groups webpage.)
[interquoting corrected]

Some Googling about "usenet" will tell you.
Does this only work for image elements?

That was not your first Q, that needed only 1 affirmative example.
I tried it on a div element and nothing :(

What would be the logic or the use?
Could you answer that re <div>?
>It is not the loading of an element that is flagged,
but the loading of external data by that element.
And <divhas none.
Do you agree with that?
regarding the topic;
I am trying to call a method which calls a number of further methods
upon some event.
"method"?

Do you mean a javascript function with "method"?
Is that all clientside code?
At the moment I have a <script... </scriptinside
my html code which calls this function. So I am trying to remove the
script from the html and place it somewhere more appropriate.
How can serverside javascript be placed more apropriate
than in the html code?

The linking to a js file like this

<script type='text/javascript' src='xxx.js'></script>

is not necessarily "better/more apropriate",
unless you want to reuse a large chunk of code in different htmls
and want to minimize download time with slow connections.
It even has some caching drawbacks.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 28 '07 #6
Lee
ma***************@googlemail.com said:
>
On Jun 27, 8:59 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
> wrote on 27 jun 2007 in comp.lang.javascript:
On Jun 27, 7:17 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 27 jun 2007 in comp.lang.javascript:
Is it possible to have onload events on elements other than the body
tag ?
><img
src = '...jpg'
onload = 'alert(this.src+ " is found");'
onerror = 'alert(this.src+ " is NOT found");'

[please do not quote signatures, a good newsreader will skip them for you]
Does this only work for image elements?

That was not your first Q, that needed only 1 affirmative example.
I tried it on a div element and nothing :(

What would be the logic or the use?

It is not the loading of an element that is flagged,
but the loading of external data by that element.
And <divhas none.

what's a newsreader? what's a good newsreader? (I am using the google
groups webpage.)

regarding the topic;
I am trying to call a method which calls a number of further methods
upon some event. At the moment I have a <script... </scriptinside
my html code which calls this function. So I am trying to remove the
script from the html and place it somewhere more appropriate.
It sounds like your best option is to use the body's onload handler.
--

Jun 28 '07 #7

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

Similar topics

3
by: bb | last post by:
I need to capture the following events in IE 5+ and Netscape 6: - Enter new address in URL window and click "GO" - Select a favorite - Click "Home" button - Click "Back" or "Forward" button ...
2
by: Starry Gordon | last post by:
I've been running some small test programs which seem to indicate something noticed in a larger script, that a function called from onLoad() in the <body> tag will not succeed in creating a window...
5
by: gbit | last post by:
Hi, I have a web page describing a procedure using generic names. At the top of the page I have a text box. When the user enters a specific name in the text box, I would like the page to...
4
by: UJ | last post by:
I have some javascript code that I need to run based on a value I know at the server when I load a page. How can I do an onload event call with a condition value from the server. (The reason is...
0
by: Andy Fish | last post by:
Hi, I managed to figure this one out for myself but thought I would post it here for the general good. I have an asp.net 1.1 application which was using smart navigation and also had a <body...
3
by: Mike Cain | last post by:
Hi I have a JS library that I want others in my company to use that uses AttachEvent (etc) to add a method to the onLoad event so that it is called. Using this approach of course is good because...
6
by: Michael Landberg | last post by:
Hi is it possible to load multiple onload events in the body tag? Regards
3
by: MikeP | last post by:
Hi there, I've tried hunting for this in the C# specs but can't find the relevant info. Does anyone know what the official rule says (or doesn't say) about removing an event more than once. If...
7
by: Lenny5160 | last post by:
I have an Access 2003 form with 58 checkboxes. Each checkbox has 2 corresponding combo boxes, which I would like to keep hidden until their box has been checked. The naming is consistent, with the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
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...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.