/    Sign up×
Community /Pin to ProfileBookmark

Mixing results of user inputs via checkboxes

I have 2 pages:

Page1.htm
has a form with 100 checkboxes with various values
user selects any number of them and the page saves the results by cookie
(itemlist=”0,45,62,75,78,99″)

Page2.asp
retrieves the cookie and “mixes” the results of page one… (or would if I could figure it out…. ?
currently I can get the items from the cookie and put it into an array (items[0]=0 ; items[1]=45 ; items[2]=62 ; etc…)

Now, I need to “mix” the items….
currently I have to create about a million if [x] && [i] then statements (item 0 would be mixed with item 0 to create {output1} ; then item 0 would be mixed with item 45 to create {output2}; then item 0 would be mixed with item 62 to create {output3}; etc… to item 99 mixing with item 99 to create {output21}
Is there a way to produce the same outputs without a million {if then} statements? Or do I need to “bite the bullet” and possibly get Carpal Tunnel syndrome as I type it all out?

TIA

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsApr 08.2005 — [code=php]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--
var Ary=new Array(0,45,62,75,78,99)

function Mix(){
html=''
for (i0=0;i0<Ary.length;i0++){
for (i1=i0;i1<Ary.length;i1++){
tb=document.createElement('INPUT');
tb.size=4;
tb.value=Ary[i0]+Ary[i1];
document.getElementById('tom').appendChild(tb);
html+=Ary[i0]+Ary[i1]+'n';
}
}
document.getElementById('fred').value=html;
}
//-->
</script></head>

<body onload="Mix();" >
(itemlist="0,45,62,75,78,99")
<textarea id="fred" rows="21" cols="10"></textarea>
<div id="tom" ></div>
</body>

</html>
[/code]
Copy linkTweet thisAlerts:
@HatchingaBrainauthorApr 09.2005 — alright... that looks cool!... gimme a few days to sort it out... ? (where did I put that bottle of asperin?....)
×

Success!

Help @HatchingaBrain spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...