JavaScript

JavaScript is:-

-a lightweight, interpreted programming language
-Designed for creating network-centric applications
-Complementary to and integrated with Java
-Complementary to and integrated with HTML
-Open and cross-platform

Advantages of JavaScript:-

-Less server interaction: You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.
-Immediate feedback to the visitors: They don't have to wait for a page reload to see if they have forgotten to enter something.


JavaScript Syntax:-
A JavaScript consists of JavaScript statements that are placed within the <script>... </script> HTML tags in a web page.

Your First JavaScript Script:-
Let us write our class example to print out "Hello World".

<html>
<body>
<script language="javascript" type="text/javascript">
   document.write("Hello World!")
</script>
</body>
</html>


The script tag takes two important attributes:

language: This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.

type: This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".
we call a function document.write which writes a string into our HTML document. This function can be used to write text, HTML, or both. So above code will display following result:

Hello World!










2 comments:

We are here to listen you, Comment your valueable opinion...!!!