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

(!stay) in a tutorial

P: n/a
I came across following code in a tutorial. I originally thought the
word 'stay' in (!stay) was not important, and could be replaced by
another word. The negation mark (!) was doing the whole work. But when
replacing the 'stay' with another word, such as 'remain', the if
conditional did not work.

As far as I know, 'stay' is not a reserved word, and is not defined in
the code, either. How come it is a must?

<html>
<head>
<script type='text/javascript'>

var stay=confirm ("The following site contains appalling material
suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit
immediately!")

if (!stay){
window.location="http://www.yahoo.com"
}
</script>
</head>
<body>
Appalling material here
</body>
</html>

The web page is in:
http://www.pinyinology.com/learning/stay.html

Thanks.
Dung Ping

Sep 29 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
stay is not a reserved word

When you say you replaced "stay", did you replace it in both:-

if (!remain)...

AND

var remain=confirm(...

?

Sep 29 '05 #2

P: n/a
"Dung Ping" <du*******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I came across following code in a tutorial. I originally thought the
word 'stay' in (!stay) was not important, and could be replaced by
another word. The negation mark (!) was doing the whole work. But when
replacing the 'stay' with another word, such as 'remain', the if
conditional did not work.

As far as I know, 'stay' is not a reserved word, and is not defined in
the code, either. How come it is a must?

<html>
<head>
<script type='text/javascript'>

var stay=confirm ("The following site contains appalling material
suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit
immediately!")

if (!stay){
window.location="http://www.yahoo.com"
}
</script>
</head>
<body>
Appalling material here
</body>
</html>

The web page is in:
http://www.pinyinology.com/learning/stay.html

Thanks.
Dung Ping


Did you replace all (both) uses of "stay"?

var stay

if (!stay){
Sep 29 '05 #3

P: n/a
I was stupid and careless. I thought I had discovered a miracle word,
and posted a stupid question to the forum. The 'stay' was there. I
simply didn't see it.

Thanks a lot and I am sorry for the annoyance.

Dung Ping

McKirahan wrote:
"Dung Ping" <du*******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I came across following code in a tutorial. I originally thought the
word 'stay' in (!stay) was not important, and could be replaced by
another word. The negation mark (!) was doing the whole work. But when
replacing the 'stay' with another word, such as 'remain', the if
conditional did not work.

As far as I know, 'stay' is not a reserved word, and is not defined in
the code, either. How come it is a must?

<html>
<head>
<script type='text/javascript'>

var stay=confirm ("The following site contains appalling material
suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit
immediately!")

if (!stay){
window.location="http://www.yahoo.com"
}
</script>
</head>
<body>
Appalling material here
</body>
</html>

The web page is in:
http://www.pinyinology.com/learning/stay.html

Thanks.
Dung Ping


Did you replace all (both) uses of "stay"?

var stay

if (!stay){


Sep 29 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.