How to use JavaScript language in HTML document ?

JavaScript contain javascript code statement which are placed within <script> </script> HTML tags in web forms.
we can write javascritp code within <script> tage anywhere in the web page but most preferred way to place it within <Head> tags in web page.

The JavaScript syntax like:

write your JavaScript code here….

The script tags has two main attributes :
language: This attributes describe the language which you are using.
Here language=javascript
type: The type attribute indicate the scripting language in use.

Now, the JavaScript statement look like below:

<script language=”javascript” type=”text/javascript”>
write your JavaScript code here….

Exmaple of JavaScript:

<script language=”javascript” type=”text/javascript”>
document.write(“Meera Academy”)

The JavaScript documnet.write function writes the string / text into HTML document.

Leave a Reply

Your email address will not be published. Required fields are marked *