window.confirm behaviour in if else statements

D

Doo0592

Hi all,

Judging by the topics in here this should be a snap for all of you!

Can any one explain why when i use the window.confirm in an if else
statement it behaves like this:

if (var == value)
{
do this
}
else
{

addTheTrack = window.confirm('confirm overwrite')


if(addTheTrack == true)
{
do that
};
};


addTheTrack is initialised earlier.
When i execute this code is does the window.confirm action whether if
(var == value) is true or not and if i switch it to if (var = value)
then it does the else...

Mucho confoosed.

Any help appreciated Doo x
 
R

RobG

Doo0592 said:
Hi all,

Judging by the topics in here this should be a snap for all of you!

Can any one explain why when i use the window.confirm in an if else
statement it behaves like this:

if (var == value)

"var" is a javascript keyword, you can't assign a value to it (you
should get an error). Therefore it can never have the same value as
some other variable - use some other name.

[...]
addTheTrack is initialised earlier.
When i execute this code is does the window.confirm action whether if
(var == value) is true or not and if i switch it to if (var = value)
then it does the else...

As far as I can see, the condition expression results in a syntax error
and that's the end of that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top