I have, not necessarily a Jscript question, but a programing question.
In an html file I call a Jscript function and pass it 4 variables:
<script language="JavaScript1.2">myfunction(var1,var2,var3,var4);</script>
the Jscript function is in an external .js file.
Each variable can have up to 5 options opt1, opt2, opt3, opt4, opt5 - for simplicity.
the 4 variables correspond to 4 components of output to the screen: var1 is email address, var2 is number of times visited site, etc......
so my output:
if (var1=opt1 and var2=opt2 and var3=opt3).......
document.write(opt1[count]+" "+opt2[count]+" "+etc....);
elseif (var1=opt2 and var2=opt2 and var3=opt3).......
document.write(opt2[count]+" "+opt2[count]+" "+etc....);
can you see where this is going? One thousand and Twenty Four IF statements, that's not cool at all........
let me try to clarify some questions you might have:
1) the options are arrays defined in the external .js file. So the email address opt1 will have say 27 email addresses in the array.
2) this is for survey results
3) no I can't use php
4) it's for sorting purposes that are relatively irrelevant to this question
5) I asked in this forum because I was hoping Jscript has some fancy something I can do to eliminate the need for so many IF statements.
I am very openminded and will try just about anything,
Thanks for your help,
Michael
In an html file I call a Jscript function and pass it 4 variables:
<script language="JavaScript1.2">myfunction(var1,var2,var3,var4);</script>
the Jscript function is in an external .js file.
Each variable can have up to 5 options opt1, opt2, opt3, opt4, opt5 - for simplicity.
the 4 variables correspond to 4 components of output to the screen: var1 is email address, var2 is number of times visited site, etc......
so my output:
if (var1=opt1 and var2=opt2 and var3=opt3).......
document.write(opt1[count]+" "+opt2[count]+" "+etc....);
elseif (var1=opt2 and var2=opt2 and var3=opt3).......
document.write(opt2[count]+" "+opt2[count]+" "+etc....);
can you see where this is going? One thousand and Twenty Four IF statements, that's not cool at all........
let me try to clarify some questions you might have:
1) the options are arrays defined in the external .js file. So the email address opt1 will have say 27 email addresses in the array.
2) this is for survey results
3) no I can't use php
4) it's for sorting purposes that are relatively irrelevant to this question
5) I asked in this forum because I was hoping Jscript has some fancy something I can do to eliminate the need for so many IF statements.
I am very openminded and will try just about anything,
Thanks for your help,
Michael