John,

Thanks,

Far


-----Original Message-----
From: John Vieth [mailto:[EMAIL PROTECTED]
Sent: Monday, January 03, 2005 9:23 AM
To: [email protected]
Subject: RE: [ASP] Javascript Questions


I just skimmed your message, so I'm not sure if this is the *only*
problem, but I noticed that in the following line of code...

> if   (strCity = "Atlanta") { alert ("Atlanta")     }

...in your conditional statement you're using the assignment operator
(=) and not the equals comparison operator (==).  Maybe you *want* to do
that, but usually people only do that by mistake.  In this case, the
conditional statement will always evaluate to true, because you will
always be able to assign "Atlanta" to strCity.

Hope that helps.

- John

> -----Original Message-----
> From: The Professional Network
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 31, 2004 5:49 PM
> To: ASP Developers
> Subject: [ASP] Javascript Questions
>
>
> I started to convert a simple VBS validation script to
> JavaScript, when I came across a syntax problem that has me
> buffaloed.  Consider the following
> page:
>
>
>
> <html>
>
>   <head>
>
>     <title>
>       Example_01
>     </title>
>
>   </head>
>
>   <body>
>
>     <form
>       name="frmForm"
>       action="Example_01_Redirect.asp"
>       method="post"
>     >
>
>
>       <Input
>         type="button"
>         name="cmdSubmit"
>         value="Send Request"
>         OnClick="Validation()"
>         >
>
>       <br>
>       <br>
>
>       City
>       <br>
>       <input
>         type="text"
>         size="15"
>         name="txtCity"
>         value=""
>         >
>
>       <br>
>       <br>
>
>
>       The Local Weather
>       <br>
>       <textarea
>         name="txtWeather"
>         rows="5"
>         cols="50"
>         value=""
>         ></textarea>
>
>       <br>
>       <br>
>
>       Test 15
>
>     </form><!-- frmForm -->
>
>   </body>
>
> </html>
>
>
> <script
>   language="javascript"
>   >
>
>   function Validation()
>     {
>
>       strA = "Detroit"
>
>       alert (strCity)
>
>       if   (strCity = "Atlanta") { alert ("Atlanta")     }
>       else                       { alert ("Not Atlanta") }
>
>     }
>
> </script>
>
>
> Nothing fancy, nothing complex.  Just a little example to see
> how the syntax works.  As a test, I made a hard assignment
> for strCity, making it = "Detroit".  On clicking the button,
> the first alert statement shows " Detroit", which obviously
> is correct.  The second alert, in the IF statement, shows the
> city as "Atlanta", when I was expecting "Not Atlanta".
>
> Obviously, the problem is in the condition test, (strCity =
> "Atlanta"), but I can't see it.  What on earth am I doing wrong?
>
> Far Farley
> www.TheAccessWizard.com <http://www.theaccesswizard.com/>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~--> Make a clean sweep of pop-up ads.
> Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
> --------------------------------------------------------------
> ------~->
>
> --------------------------------------------------------------
> -------   
>  Home       : http://groups.yahoo.com/group/active-server-pages
> ---------------------------------------------------------------------
>  Post       : [email protected]
>  Subscribe  : [EMAIL PROTECTED]
>  Unsubscribe: [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>


---------------------------------------------------------------------   
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links









---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to