Inline JavaScript Example

Card image cap

JavaScript Definition

JavaScript is a client side scripting language developed by Netscape or use within HTML web pages. JavaScript is loosely based on Java and it is built into all the major modern browsers like Internet Explorer, Firefox, Chrome, Safari etc.


Inline JavaScript:

In Inline JavaScript, the scripts can be placed anywhere on the page. The output of a page will appear where the script block is in the HTML file. for instance if the JavaScript blocks are blocks are placed in the header region of HTML document, then the dynamic content will appear in the header part of the web page and if the script blocks are at the body region of the HTML document, then the dynamic content will appear in the body part of the web page.

It is a good practice to place the scripts at the bottom of the HTML document, The reason is that each time the browser encounters a <script> tag it has to pause, compile the script, execute the script, then continue on generating the page. This takes time.

Inlining CSS and JavaScript both refer to simply including the CSS and JS within your HTML file. Inline small CSS should be included within the <head> tags of an HTML file while inline small JavaScript can be included either within the <head> tag or the <body> tag

Example:


Result :

	
	Today is Thursday. 

Card image cap