By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,909 Members | 1,775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,909 IT Pros & Developers. It's quick & easy.

window.confirm behaviour in if else statements

P: n/a
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

Sep 25 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Doo0592 wrote:
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.
--
Rob

Sep 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.