Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / October 2005

Tip: Looking for answers? Try searching our database.

Javascript If/else conditions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cleako - 21 Oct 2005 20:25 GMT
I may just be having one of those days but I cant think of a good way to do
something like this - if(item1.checked || item2.checked || item3.checked ...).

If the 1st two are true then it works, if it is the 3rd one on then it
doesnt.  I have 5 controls I need to check for a checkbox in so that I can
control what type of file a user is choosing for processing.  What do I do if
I have more than 2 items to compare against?  In .NET this isnt an issue so I
guess I am just braindead today.
Bruce Barker - 22 Oct 2005 00:50 GMT
your syntax is correct. most likely one of the items is null, so the script
is dieing when you ref the checked property.

if the item may or may not exist then:

if ((item1 && item1.checked) || ((item2 && item2.checked) )

>I may just be having one of those days but I cant think of a good way to do
> something like this - if(item1.checked || item2.checked || item3.checked
[quoted text clipped - 7 lines]
> so I
> guess I am just braindead today.
Cleako - 22 Oct 2005 20:54 GMT
So the (item1 && item1.checked) is only checked if the item1 has been
populated?  I thought that the .checked would either be true or false, what
would make it return a null value?

Cleako

> your syntax is correct. most likely one of the items is null, so the script
> is dieing when you ref the checked property.
[quoted text clipped - 14 lines]
> > so I
> > guess I am just braindead today.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.