JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Another simple, easy question! Posted by superjoe30 on 13 Mar 2002 at 10:33 AM
1. Where can I get EZ info on basic JavaScript on the web?


2. What is the format for a simple if, then, else statement?

Ex. (I know this is the wrong thing)
var text
text = prompt("Question", "thing that appears")
(this is the part)
if(text = "certain thing") then
(action)
else
(no action)
end if


Thanks! -- superjoe30 --
Report
Re: Another simple, easy question! Posted by garwain on 13 Mar 2002 at 10:47 AM
your if statement should be like this:
 var text
 text = prompt("Question", "thing that appears")
 (this is the part)
 if(text = "certain thing") 
  {
 (action)
 }
  else
 {
   (no action)
 } 


Ben Martin
programmer


Report
Re: Another simple, easy question! Posted by Secret_Doom on 13 Mar 2002 at 12:35 PM
I believe the double equals is necessary on an IF statement...

if(text == "certain thing")


BTW, the ELSE statement isn't necessary. I mean that you may only have action to if the IF statement is TRUE, you don't have do open the ELSE statement and close it without performing any actions.

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br

: your if statement should be like this:
:
:  var text
:  text = prompt("Question", "thing that appears")
:  (this is the part)
:  if(text = "certain thing") 
:   {
:  (action)
:  }
:   else
:  {
:    (no action)
:  } 

:
: Ben Martin
: programmer
:
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.