JavaScript is applied to HTML page in a similar manner like CSS. Whereas CSS uses <link> elements to apply external stylesheets and <style> elements to apply internal stylesheets to HTML, JavaScript only needs one friend in the world of HTML, the <script> element.
There are three different ways using which user can add JavaScript into webpage.
1. Inline JavaScript
2. Internal JavaScript
3. External JavaScript
Inline JavaScript
JavaScript written within the HTML element with the event handling attribute then it is called as inline JavaScript. This method is used when we have to call a function in the HTML event handler attribute. Many cases where we have to add JavaScript directly are onclick, onmouseover, onload etc. In this method, JavaScript can be added in HTML directly without using <script> tag.
<HTML>
<HEAD>
<TITLE>Inline JavaScript</TITLE>
<//HEAD>
<BODY>
<form>
<Input type="Button" value="Clickme" onclick="alert('Button Click')">
</form>
</BODY>
</HTML>
If you have any doubt, let me know...