[an error occurred while processing this directive]

Conditions In Java Script

                         

In this article you learn the basics of JavaScript and create your first JavaScript program.

About JavaScript

Java Script is Netscape's Cross - platform, Object - based Scripting language for Client and Server applications. It is a Case sensitive application. JavaScript programs are usually embedded directly in HTML files. The script executes when the user's browser opens the HTML file. JavaScript is different from the Java language. Now the biggest problem is the imperfect JavaScript implementations that today's browsers offer. Although all major browsers that are version 3.0 or higher include JavaScript code support, they deal with JavaScript differently. In fact, different versions of the same browser handle JavaScript differently. This makes it difficult to create a complicated JavaScript code that work across all browsers. So always check your pages on as many different browsers (and even platforms) as possible.

The Simple Example to display the Sum of two Digits :-

<html>
<head>
<script language="javascript">
function showAlert()
{
val1=20;
val2=10;
document.write("sum="+(val1+val2));
}
</script>
</head>
</body>

<script type="text/javascript">

showAlert();

</script>

</body>
</html>

JavaScript code is embedded in HTML within a <SCRIPT> tag. It can be used to any number of JavaScript Statements. showAlert() is a function to use in JavaScript language. Val1 and Val2 is a data type. we take the value 20 and 10 in val1 and val2. Document.write is also a function to use  print the Message and values. The result is 20 display on the Screen.

 

                         

[an error occurred while processing this directive]