JAVA Script

What is JAVA Script?

JavaScript is a technology that allows you to enhance the functionality of your Web pages by embedding applications directly into your HTML. You can use JavaScript to build applications that range from adding interactivity to your pages to applications that interact with databases. This technology is supported by almost all modern browsers like Mozilla, Google chrome, IE etc. there is no need to have licence to use java script. JavaScript is usually embedded directly into HTML pages. JavaScript is a scripting language. Actually java and JavaScript both are different technology. JavaScript is usually embedded directly into HTML pages. JavaScript has very simple syntax everyone can use very easily. JavaScript is used to react to user action when user performs certain action Java Script responds to user action. One very common application of java script is validation of user data like emailed this saves the server from extra processing. Different platform require different font so we have to detect the type of browser user is using, in short JavaScript can be used to Generating Platform-Specific Content. There are two methods that you can use to include JavaScript in your Web pages—client-side and server-side. Both methods share the same basic language sets. This core language defines a base set of objects and features that will work in both client-side and server-side applications. Each method also has its own Extended object and feature sets.

 

Client-Side JAVAScript:

Client side JavaScript works in browser which is directly embedded inside HTML. When the user’s browser calls up an HTML page with JavaScript embedded in it, the browser’s JavaScript runtime engine interprets the script from the top down, executing statements as it goes.  Basically client side JavaScript is used to react to the user action like clicking; scrolling etc. client side script can validate input too.

 

The first step to writing any JavaScript is to tell the browser that the code you are

Putting into your Web page is not HTML, but a JavaScript application. Once it

Knows this it will send the information to the JavaScript runtime engine, which will execute the script. For most scripts we accomplish this by enclosing

The Scripts in the <SCRIPT> tag:

<SCRIPT>

<!—you can write your statements here>

</SCRIPT>

 

Window is top at the JavaScript hierarchy. Object is the actual window in which your browser appears.

 

JavaScript

 

Simple program in java script

<Html>
<body>
<script type=”text/JavaScript”>
document.write (“<h1>this is my fist program in java script!</h1>”);
</script>
</body>
</html>

You can write function in java script syntax for function is as follows

function  name_of_your_Function(var1,var2,…,var _n)
{
statements
}

this example of function with parameter if you don’t want to pass any parameter then simply write function functionname()

 

here is the example of function in javascript

<html>

<head>

<script type=”text/javascript”>

function myfun()

{

alert(“welcome to the world of java script”);

}

</script>

</head>

<input type=”button” value=”CLICK!” onclick=”myfun()” />

</body>

</html>

 

If you want to return values then you can do that using return keyword syntax is

Function add(int a,int b)

{

Return( a+b);

}

Advantages:

  • JavaScript is executed on the client side.
  • JavaScript is a relatively easy language.
  • JavaScript is relatively fast to the end user
  • Extended functionality to web pages

 

Disadvantages:

  • Security Issues
  • JavaScript rendering varies

For more reading about technology news in singapore and seo to online marketing do view more about other pages.

Written by Sourabh Bhunje

Sourabh Bhunje, B.E. IT from Pune University. Currently Working at Techliebe. Professional Skills: Programming - Software & Mobile, Web & Graphic Design, Localization, Content Writing, Sub-Titling etc. http://techliebe.com/about-us

Leave a Comment