Lession 7. JS if else

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

if else in javascript :-

Syntax:

if(condition)

{

//code for execution;

}

else

{

//code for execution;
}

if condition is true then code written in his body execute, otherwise else’s code execute.

Example: 

<HTML>
<HEAD>

<SCRIPT LANGUAGE=”JavaScript”>
<!–

<>function password() {

<>pass = prompt(’Type the word education’,”");

<>if(pass==”education”) {

location = ‘lession 2.html’;

}
else
{

alert(”Please try again”);
}
}
// –>
</SCRIPT>

</HEAD>
<BODY>

<A href=”javascript:password()”>
<IMG src=”pict.gif” NAME=”pic1″ ALT=”about us!” BORDER=”0″ align=”left”> </A>

<H3>Click the image to enter a password protected document. Try a wrong entry first.</H3>

</BODY>
</HTML>


• • •
 



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