volitics Posted April 6, 2007 Share Posted April 6, 2007 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 More sharing options...
pulpfiction Posted April 6, 2007 Share Posted April 6, 2007 Try this... [function call seperated by ;]<body onload="java script:logoAlign(); setWidth(); alignCell()"> Link to comment Share on other sites More sharing options...
volitics Posted April 6, 2007 Author Share Posted April 6, 2007 pulpfiction;Thanks for responding.Using semi colons works. But it also works using the commas. Am I supposed to use semi-colons instead of commas? Link to comment Share on other sites More sharing options...
pulpfiction Posted April 6, 2007 Share Posted April 6, 2007 Semi colon shows the end of line in JavaScript. guess its better to use ;...... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now