Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14451

Re: the if condition not workiong properly

Message-ID <1597347.oMNUckLgyt@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-06-11 13:12 +0200
Subject Re: the if condition not workiong properly
Newsgroups comp.lang.javascript
References <dfc89f22-155c-44f0-aaf6-9bb50f237395@t2g2000pbl.googlegroups.com> <4fd5bbd1$0$6946$e4fe514c@news2.news.xs4all.nl>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Tom de Neef wrote:

> "Ganesh" <ganesh.vemakoti45@gmail.com> schreef in bericht
> news:dfc89f22-155c-44f0-aaf6-9bb50f237395@t2g2000pbl.googlegroups.com...

Please do not post attribution novels. <http://www.insideoe.com/>

>> <html>
>> <head>
>>
>> <script type="text/javascript" charset="utf-8" </script>
>>
>> function search()
>>        {
>>         var x=document.getElementById("From").selectedIndex;
>>         var y=document.getElementById("From").options;
>>         var z=y[x].text;
>>
>>         if(z==RTC Complex)    //**** illegal statement
>>          {
>>          document.write(z);
>>          }
>>        if(z==M.D.palem)          //**** M is undefined, M.D illegal
>>          {
>>           document.write(z);
>>          }
>>        if(z==Akkayapalem)      //**** ???
>>          {
>>          document.write(z);
>>          }
>>       document.write('hi');
>>          }
>> </script>

Please add comments *below* quoted text, not inside.  To me, your posting 
looked like one big (accidental) full quote at first (as is was colored so).

"Illegal" is nonsense in programming (except where software licenses are 
concerned).  Source code can be syntactically *invalid* or *valid*, and it 
can *work* or *not work*.

The first `if' statement is syntactically *invalid*.  The second property 
access *throws a TypeError exception*, and the third statement *may throw a 
ReferenceError exception* if `Akkayapalem' was not declared and is not a 
property of an object in the scope chain.


PointedEars
-- 
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
  -- Richard Cornford, comp.lang.javascript, 2011-11-14

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

the if condition not workiong properly Ganesh <ganesh.vemakoti45@gmail.com> - 2012-06-10 22:54 -0700
  Re: the if condition not workiong properly Jason C <jwcarlton@gmail.com> - 2012-06-11 02:27 -0700
  Re: the if condition not workiong properly "Tom de Neef" <tdeneef@qolor.nl> - 2012-06-11 11:35 +0200
    Re: the if condition not workiong properly Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-11 13:12 +0200
      Re: the if condition not workiong properly John G Harris <john@nospam.demon.co.uk> - 2012-06-11 15:39 +0100
        Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-12 20:34 +0100
          Re: the if condition not workiong properly Gene Wirchenko <genew@ocis.net> - 2012-06-12 20:47 -0700
            Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-14 18:49 +0100
              Re: the if condition not workiong properly Gene Wirchenko <genew@ocis.net> - 2012-06-14 20:45 -0700
                Re: the if condition not workiong properly "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-15 06:30 +0000
                Re: the if condition not workiong properly Gene Wirchenko <genew@ocis.net> - 2012-06-15 09:42 -0700
                Re: the if condition not workiong properly "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-15 18:38 +0000
                Re: the if condition not workiong properly Stefan Weiss <krewecherl@gmail.com> - 2012-06-15 19:23 +0200
                Re: the if condition not workiong properly Gene Wirchenko <genew@ocis.net> - 2012-06-15 12:54 -0700
                Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-16 21:46 +0100
                Re: the if condition not workiong properly "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-17 08:03 +0000
          Re: the if condition not workiong properly John G Harris <john@nospam.demon.co.uk> - 2012-06-14 11:08 +0100
            Re: the if condition not workiong properly Gene Wirchenko <genew@ocis.net> - 2012-06-14 09:23 -0700
            Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-15 19:56 +0100
              Re: the if condition not workiong properly Andrew Poulos <ap_prog@hotmail.com> - 2012-06-16 13:26 +1000
                Re: the if condition not workiong properly John G Harris <john@nospam.demon.co.uk> - 2012-06-16 11:33 +0100
                Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-17 19:42 +0100
      Re: the if condition not workiong properly Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-12 20:10 +0100

csiph-web