/    Sign up×
Community /Pin to ProfileBookmark

I hate this!!! Multiple unLoad functions within <body> tag

I found out that javascript does not support multiple onLoad functions but there are work arounds. However, in my situation I am not sure if it is possible. What do you think? Any suggestions?

I have an main.xml page:

….

<componentOne> One </componentOne>
<componentTwo> Two </componentTwo>

componentOne.xsl file has a <body onLoad=”setThis()”> tag
componentTwo.xsl file has a <body onLoad=”setThat()”> tag

I have to have different xsl files. But my main.xml page refuses to to do both onLoads, it does only the first one.

Is there any way to solve this?

Thanks!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@timboyk12Jun 15.2005 — i dont know if this will work for you, but to get around it i normally stick the onload in the <img src=""> tag and it will execute with the image's loading, which is normally with the loading of the page. you can also add a one pixel image the same color as your background so you want see it.
Copy linkTweet thisAlerts:
@acorbelliJun 15.2005 — Use the second onload function and put them both together there.
Copy linkTweet thisAlerts:
@thisObjectauthorJun 15.2005 — This is exactly what I have

I cannot call onLoad in my main.xml file

javascript resides in componentOne.xsl and in componentTwo.xsl.

what I do is:

main.xml file:

....

<componentOne> One </componentOne>

<componentTwo> Two </componentTwo>

....

I DO NOT call onLoad in my main.xml file. I call onLoad in componentOne.xsl and in componentTwo.xsl files. Here is what happening. When a browser gets mail.xml page it parses it gets componentOne, looks into componentOne.xsl file and do onLoad but when it gets to componentTwo.xsl file it ignores it.

The worst thing is that I have 4 of those component and not just two.

Thanks.
Copy linkTweet thisAlerts:
@thisObjectauthorJun 15.2005 — So if I use the <img thing can I do multiple of those or it will complain?
×

Success!

Help @thisObject spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...