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.