Re: (!stay) in a tutorial
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: (!stay) in a tutorial

From: McKirahan <News@McKirahan.com>
Date: Thu Sep 29 2005 - 19:01:55 CEST

"Dung Ping" <dungping5@yahoo.com> wrote in message
news:1128012612.499609.186020@g14g2000cwa.googlegroups.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){
Received on Tue Oct 18 03:32:52 2005