By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

OnLoad events on elements other than BODY ?

P: n/a
Hya,

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

Thanks in advance,
Maria

Jun 27 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.