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:

<script>
write your JavaScript code here….
</script>

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.
type=text/javascript

Now, the JavaScript statement look like below:

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

Exmaple of JavaScript:

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

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 *

1 + 1 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">