call more than one JavaScript function in a body tag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest

    call more than one JavaScript function in a body tag

    Simple. End each function call with a semi-colon ;

    Like this:

    <body onload="someFunction();otherFunction();">

    or, say, in a mouseover...

    onMouseOver="someFunction();otherFunction();"

    In JavaScript, the semi-colon is essentially an end-of-line marker. Within reasonable limits, you can actually write a whole script inside of an event handler.

    The same thing applies to the href="javascript:etc" structure. For instance:

    <a href="javascript:someFunction();otherFunction();">
    Click Here
    </a>
Working...
😀
😂
🥰
😘
🤢
😎
😞
😡
👍
👎