You are not logged in.

1

Friday, April 13th 2012, 1:28pm

[SOLVED] if statement with 2 variables values

Hi,

i got 2 variables,
i want launch an action following the differents couple of variables values

Source code

1
2
3
4
5
6
7
8
9
//set my variables, i got them from 2 combobox choices :

set(my_var01,'var_01_result_A');  // could be  : var_01_result_B or var_01_result_C
set(my_var02,'var_02_result_A');    // could be  : var_02_result_B or var_02_result_C

// launch an action following the couple of obtained variables values :

onclick="if(my_var01 == ('var_01_result_A') && my_var02 == ('var_02_result_B'), action(my_action_A);  );
         if(my_var01 == ('var_01_result_B') && my_var02 == ('var_02_result_A'), action(my_action_B);  );"    // this is not working


So, what's the best syntax to do that ?
i have different actions for couple of variables values,

Thanks *smile*

z

This post has been edited 1 times, last edit by "zadda" (Apr 13th 2012, 7:20pm)


Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

3

Friday, April 13th 2012, 4:11pm

Thanks,

that's more complex than i was thinking *huh*


z

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Friday, April 13th 2012, 4:22pm

i'm not sure this is the best way for your 'thing' though..

maybe some other genius *g* has a better option?

Tuur *thumbsup*

Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

5

Friday, April 13th 2012, 4:40pm

Source code

1
2
3
4
5
6
7
8
9
10
if(my_var01 == 'var_01_result_A',
	if(my_var02 == 'var_02_result_B', 
		action(my_action_A);  
	);
);
if(my_var01 == 'var_01_result_B',
	if(my_var02 == 'var_02_result_A',
		action(my_action_B); 
	);
);


just nest those if's ;)

You could alsoo just do a js() call, then javascript can get krpano variables, and use better if/else/swtiches to fit your needs. Then js could call the specific krpano action

6

Friday, April 13th 2012, 7:19pm

Thanks guys !
you rock *thumbsup*

i got it,
my code is working now

z

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message