objective: to learn the if..else statements...
what is if...else statements?
if else statements are used as conditional statements..
for example .. if a certain condition is true ...which script to run .. and if it is false then what to do ...
these statements are very useful !!!
IF STATEMENT
it tells the script what to do when a certain condition is true ...
this is how it should be used :
if (condition){the code that should execute if the condition is true.}
e.g.
javascript:var a=prompt("insert a number between 1-1000","Enter number");if (a<750){alert("number is less then 750")}
IF ElSE STATEMENT
it tells the script what to do when a certain condition is true ... and what to do if it is false.
this is how it should be used :
if (condition){the code that should execute if the condition is true.}else{code to execute if it is false}
e.g.
javascript:var a=prompt("insert a number between 1-1000","Enter a number");if (a<750){alert("number is less then 750")}else{alert("number greater then 750")}
Prompt function we can give default value as second element
like
javascript:prompt("Enter your name","kunal");void(0)
I have given my name as default value.
Read all javascript tutorials Click here
This entry was posted
on Wednesday, June 18, 2008
and is filed under
javascript,
tutorial
.
You can leave a response
and follow any responses to this entry through the
Subscribe to:
Post Comments (Atom)
.
Archives
-
▼
2008
(18)
-
▼
June
(18)
- Orkut Profile Maker Without TIMERs
- Source code Status message changer for orkut
- orkut profile maker tutorial
- c# video tutorials
- Create Captcha in Vb .Net
- Orkut Basic terms gid uid tid pid aid etc
- Learn VB .NET easy way Part -1 Tutorial
- C Programming Tutorial (Algorithms)
- C Programming Tutorial Part-1
- Virtual Software Development Guideline
- Javascript Tutorial Part-3
- Javascript Tutorial Part-2
- Javascript Tutorial Part-1
- Orkut Mass Community Joiner
- Simple HTML Editor in VB .NET
- Reading From Text file VB .NET (Text file to Listb...
- Make softwares without timer in VB .NET
- Intro of the blog
-
▼
June
(18)

0 comments