![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, I need to create code with multiple possible conditions like if (x==1) or (x==2) or (x==3) {do y} else{ do z} this doesn't work. Any help would be very much appreciated, Thanks, Claus |
#3
| |||
| |||
|
|
Which language are you doing this in? It looks like your using javascript. The or for javascript is 2 pipes || if (x==1) || (x==2) || (x==3) {do y} else{ do z} -- Regards, ..Trent Pastrana www.fourlevel.com Things Dreamweaver ----------------------------------------------------------- eZeeGallery | iFrameSuite | MiniMenus | Scrollers | More... ----------------------------------------------------------- "cjobes" <cjobes (AT) nova-tech (DOT) org> wrote in message news:djv06v$dem$1 (AT) forums (DOT) macromedia.com... Hi all, I need to create code with multiple possible conditions like if (x==1) or (x==2) or (x==3) {do y} else{ do z} this doesn't work. Any help would be very much appreciated, Thanks, Claus |
#4
| |||
| |||
|
|
if(usercode==1371215708352&&passcode==156291440) || (usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} |
#5
| |||
| |||
|
|
There should only be one parenthesis (pair of (....) ) for the "if" statement. Thus, the pipes need to be inside a single parenthesis, viz: if(usercode==1371215708352&&passcode==156291440 || usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
..or place them all in parenthesis.. just depends. In this case Johns example would be cleaner. if( (x==1) || (x==2) || (x==3) ){do y} else{ do z} -- Regards, ..Trent Pastrana www.fourlevel.com There should only be one parenthesis (pair of (....) ) for the "if" statement. Thus, the pipes need to be inside a single parenthesis, viz: if(usercode==1371215708352&&passcode==156291440 || usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} |
#8
| |||
| |||
|
|
if(usercode==1371215708352&&passcode==156291440) || (usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} There should only be one parenthesis (pair of (....) ) for the "if" statement. Thus, the pipes need to be inside a single parenthesis, viz: if(usercode==1371215708352&&passcode==156291440 || usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} Note: there are lots of online resources to check your Javascript syntax e.g. http://oopweb.com/JavaScript/Documents/JST/VolumeFrames.html?/JavaScript/Documents/JST/Volume/c5.html -- Regards John Waller |
#9
| |||
| |||
|
|
John, Thanks for the answer and the link to the resorces. I bookmarked them for future reference. This code is just a temp solution. What I really like to achieve is the following: On occasion, clients need to download confidential zip files. I would like to be able to send them a link in an email that has the authentication already included so they don't have to input username and password. After one download the link should become invalid. Do you know of any product on the market that we could use for this? I searched on the net but couldn't find anything Claus "John Waller" <johnw (AT) REMOVETHISpinnacleweb (DOT) com.au> wrote in message news:djv417$hkq$1 (AT) forums (DOT) macromedia.com... if(usercode==1371215708352&&passcode==156291440) || (usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} There should only be one parenthesis (pair of (....) ) for the "if" statement. Thus, the pipes need to be inside a single parenthesis, viz: if(usercode==1371215708352&&passcode==156291440 || usercode==12696441744&&passcode==7658280560) { window.location=password+".zip"} Note: there are lots of online resources to check your Javascript syntax e.g. http://oopweb.com/JavaScript/Documents/JST/VolumeFrames.html?/JavaScript/Documents/JST/Volume/c5.html -- Regards John Waller |
![]() |
| Thread Tools | |
| Display Modes | |
| |