Jump to content

Can I include multiple functions called by "onload" JS event in the same <body> tag?


volitics

Recommended Posts

Hello;I'm working on a web site where I've got three JavaScript functions defined in the <header> tag. All three functions are activated by the "onload" JS event. My question is: Can I put all three of the functions inside the <body> tag and call/activate all of the functions with the same "onload" JS event?I have scoured the W3Schools web site documentation and have not found the answer. All of the examples that I have found have only one (1) JS function called using the "load" JS event.Here are the functions:

<head><script type="text/javascript">function logoAlign()  {  document.getElementById('logo').align="center";  }function setWidth()  {  document.getElementById('navCell00').width="150px";  document.getElementById('navCell01').width="350px";  document.getElementById('navCell02').width="260px";   }function alignCell()  {  document.getElementById('topNav').align="center"  }</script></head>

I have put the three functions all inside the <body> tag like so:

<body onload="logoAlign(), setWidth(), alignCell()">

The first function aligns the page logo image, the second function sets the width of columns within a table, and the third functions aligns the text inside table cells.Thanks in advance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...