devxlogo

Using More Than One OnLoad Command

Using More Than One OnLoad Command

Question:
Is it possible to use more than one onLoad command in my

tag?

Answer:
Sure. Like other event handlers, the onLoad event handler you’re including within the

tag on your page can actually be any valid piece of JavaScript code. This means that you’re not limited to executing just one command. If you’d like, you can include multiple commands, separating each one with a semicolon (;), as per the standard JavaScript syntax. However, unless you’re including only one or two simple commands, you’d be better off calling a function. This gives you the flexibility of adding more complex event handling code later on without making your HTML hard-to-read.

devx-admin

Share the Post: