Introduction to JavaScript

   »    Free Introductory JavaScript Tutorial, Learn to Start JavaScript Coding

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Web Designing Courses » Introduction to JavaScript »

if else in javascript :-

Syntax:

if(condition)

{

//code for execution;

}

else

{

//code for execution;
} (more…)


• • •
 

An alert box is often used if you want to give any information to the user.

Syntax :

alert(”text“);

Example:-

function popupalert()

{

alert(’This is an alert box.’);

} (more…)


• • •
 

Comments can be used to make the code more readable.

Single line comments start with //.

<script type=”text/javascript”>

// This will write a header:

document.write(”<h1>This is a header</h1>”); (more…)


• • •
 

Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.

In JavaScript we have the following conditional statements:

if statement - use this statement if you want to execute some code only if a specified condition is true

Let’s look at some examples.
eg. 1

var a = 5;var b = 5;
if (a == b)  
{  
alert("The two quantities are equal");  
 }

eg. 2  (more…)


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com