Hello folks; See this simple script: var V=""; var Tpe=""; var Tpe=10; if (Tpe=10) { V1="nut"; } if (Tpe=5) { V1="radio"; } if (Tpe=6) { V1="Provider"; } document.write(Tpe + " / " + V+ "<br />"); When I excecute it, the answer = 6 / Provider. I has expected 10 / nut So what do I miss ??????? Thanks in advance, Rudy
You don't need the BLUE line. You need to fix the RED variables. Don't know if that will fix your problem or not, but it is a start.
your if statements are wrong.. when comparing it should be double equal sign.. using a single equal sign will assign the value to that variable even it is inside the if statement.. it should be like this: var V=""; var Tpe=""; var Tpe=10; if ([COLOR="#FF0000"]Tpe==10[/COLOR]) { V1="nut"; } if ([COLOR="#FF0000"]Tpe==5[/COLOR]) { V1="radio"; } if ([COLOR="#FF0000"]Tpe==6[/COLOR]) { V1="Provider"; } document.write(Tpe + " / " + V+ "<br />"); Code (markup):
Johnny;Thank you for your support! I am a newbee in Javascript, but i'm learning, i'm learning.....greetz, rudy