Click to See Complete Forum and Search --> : java exit function


z_mirza
02-13-2003, 10:08 PM
hey everyone, you know how in java you can have an if statement and if it comes out true or false u can exit the whole program and the rest of the code is ignored just by saying System.exit(0); well is there a way to make the browser ignore the rest of you script if an if statement comes out a certian value thanx in adv

pyro
02-13-2003, 10:11 PM
Sure:

if (x == 1)
{
//do this if x is equal to one
}
else
{
//do this if x is not equal to one
}

z_mirza
02-13-2003, 10:55 PM
no no i need to exit on the else part, how do u exit or stop it from reading the rest of the script code, cuz the if statement is set up so that if it comes out false the rest of the script shouldnt run but if its tru the rest should run, get it?
and i need to kno how to do it in JScript not java

pyro
02-13-2003, 11:32 PM
I think I know what you mean, and what I posted will do that...

if (x == 1)
{
//the rest of your script goes here
}
else
{
//don't need anything here if you don't want...
}

khalidali63
02-14-2003, 06:17 AM
There is no replacement of
System.exit(0);

in JavaScript.As a matter of fact a brower tyically is prgrammed to read all the contenets of the JavaScript code and determine what it must do and keep this information in the memory for the use with the user interaction on the page.
So answer to your question is thatJavaScript does not have the same functionality as java (System.exit(o) ) does.

Cheers

Khalid

z_mirza
02-14-2003, 08:12 PM
thax alot