HTML Tutorial - HTML Javascript


Javascript is a client side script used widely by web developers to manipulate Images and dynamically change in HTML.

Javascript can be embedded on the same web page or maintained as an external file. If it is an external file then it can be used for many webpages, making maintenance/change easy.

HTML Javascript Example
Source: Result:



HTML Javascript Events


We can use Javascript Events in many ways. Shown below is an simple example of events.

HTML Javascript Example

Source: Result:



Note: The event is triggered from the HTML Button. It calls the Javascript Program on clicking the button.

HTML <noscript> Tag


We <noscript> Tag can be used to identify the browsers that do not support Javascript or have disabled the Javascript in their browsers.

<noscript> Tag contents only be visible if the javascript can not be used by the browser, else it will be ignored.

HTML Javascript Example

Source: Result:



Javascript in External File


If you are using a javascript that is common across web pages then you can use an external file linkup using <script> Tag. The example is as shown below.

Example:
<script src="Externalfile.js" type="text/javascript" />
Note: The src attribute is used to mention the external file name that has the javascript.