473,396 Members | 1,891 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,396 software developers and data experts.

Append function to onLoad

Hi,
I am writing a function which will be included on other pages. I need
to append a function call to the body onload event without disrupting
other function calls which may/may not be there. Does anyone know how
to achieve this?

Oct 1 '06 #1
4 4863
Hello Steve!

Check this url: http://www.dustindiaz.com/top-ten-javascript

You will find what you are looking for.
Hugo Madureira
Steve Macleod wrote:
Hi,
I am writing a function which will be included on other pages. I need
to append a function call to the body onload event without disrupting
other function calls which may/may not be there. Does anyone know how
to achieve this?
Oct 1 '06 #2
Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:
I am writing a function which will be included on other pages.
Other?

Oh you mean in an include file.
I need
to append a function call to the body onload event without disrupting
other function calls which may/may not be there. Does anyone know how
to achieve this?
will this help?

======= test.html ===============
<body onload="alert('a');">

<script type='text/javascript'>

function b(){
alert('b');
};

var x = window.onload
window.onload = function(){b();x();}

</script>
==================================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 1 '06 #3
Yeah that is it!
simple really, I guess. Must have been at this too long!

Thanks for the help!

Oct 1 '06 #4
Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:
Yeah that is it!
simple really, I guess. Must have been at this too long!
Sorry, What are you talking about?

On usenet please always quote, usenet is not email.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 1 '06 #5

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

Similar topics

1
by: Patrick Gibbons | last post by:
What I would like to do is create header and footer information for my webpages which are created by calling from a referenced .js page . . . for example in Header.js: <script...
2
by: brian | last post by:
question about Onload function can one define more than one function for Onload ? <body Onload="function1()"> or can one define multiple functions one after another like <body Onload="f() g()...
11
by: JS | last post by:
I have made a function createFirstMenu where I call "resetMenu" in a JavaScript. But nothing happens when I call resetMenu. function createFirstMenu(sel){ sel = document.getElementById('sel1');...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: Eric Lemmon | last post by:
Hello C# Gurus, Please excuse my VB mindset. I am writing a class library in C# that is used by a VB ASP.NET app. When SQL Server detects a data validation exception, I want to use a C#...
7
by: Q | last post by:
Question: why doesn't: window.onLoad = recalculate(); work, and do I have to use: window.onLoad = recalculate; (IE) ???
1
by: zebra242 | last post by:
I'm working to get the onLoad function of a javascript to work: the script allows form buttons in html to refer to labeled frames in flash. Which works fine. Now I want to add onLoad...
2
by: WGW | last post by:
Hello all, I need another set of eyes cause it just isn't working, no matter how identical I make it. The initRotator function works when called by itself, but when adding another function, only the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.