Ermmm, yup, I think. You can dynamically build the elements array and either
do...

for ( var i = 0; i < elements.length ;++ ) {...}

... or...

for ( var i = 0; i < #query.RecordCount# ;++ ) {...}

I'd go for the first one because I'm not keen on mixing CF and JS, but the
second might be faster.

Ade

Can we be in this pool when it's done? :OD

-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: 17 August 2004 00:42
To: CF-Talk
Subject: Re: _javascript_ question

its lookiung like it makes sense!!! good.

ok, the for (...) { part needs to know how many too loop through, right?

ok, how the heck can cf tell the _javascript_, how many times to loop,
that variable
will be available in a cfquery.recordCount, which is, i supps how ill
build the elements array()

right?

tw

On Tue, 17 Aug 2004 00:36:12 +0100, Adrian Lynch
<[EMAIL PROTECTED]> wrote:
> Yup, sorry, my code wasn't too hot.
>
> // Get references to the selects
> elements = new Array(
>        getElementById('select_1'),
>        getElementById('select_2'),
>        getElementById('select_3'),
>        getElementById('select_4'),
>        ...
>        ...
> );
>
> function myOnChange() {
>
>        for (...) {
>                if ( elements[i].options[elements[i].selectedIndex].value
==
> this.options[this.selectedIndex].value ) {
>                        elements[i].selectedIndex = 0; // Set the other
select back to the top
> option
>                }
>        }
>
> }
>
> Didn't test that, does it work?
>
> Ade
>
> -----Original Message-----
> From: Tony Weeg [mailto:[EMAIL PROTECTED]
> Sent: 17 August 2004 00:22
> To: CF-Talk
> Subject: Re: _javascript_ question
>
> adrian...
>
> thank you, now, how can i marry that with matt's idea?
>
> tw
>
> On Tue, 17 Aug 2004 00:16:21 +0100, Adrian Lynch
> <[EMAIL PROTECTED]> wrote:
> > As an overview, in the onChange call a function that loops through all
the
> > other selects and checks their selected values/indexes(which ever makes
> more
> > sense)
> >
> > elements = new Array(
> >        getElementById('select_1'),
> >        getElementById('select_2'),
> >        getElementById('select_3'),
> >        getElementById('select_4'),
> >        ...
> >        ...
> > );
> >
> > Then a function that you call with onChange of all those selects.
> >
> > for (....) {
> >        if elements.selected index/value = the current selected
index/value
> {
> >                alert("something");
> >        }
> > }
> >
> > Hows about that?
> >
> > Ade
> >
> > -----Original Message-----
> > From: Tony Weeg [mailto:[EMAIL PROTECTED]
> > Sent: 17 August 2004 00:01
> > To: CF-Talk
> > Subject: ot: _javascript_ question
> >
> > hello good peoples...
> >
> > i have a _javascript_ question, that really aims for a coupla things...
> >
> > 1. can this be done elegantly?
> > 2. if not, then whats the best non-elegant way?
> > 3. if so, a bit of a point in the right direction...i can READ
> > _javascript_, most of the time, and tell ya whats going on...however, i
> > SUCK, with a capital freakin' S at writing it...anyway, im sick of
> > bugging mike t. all the time with my _javascript_ questions...so i
> > figured i try here, and im sure he'll read this...but whatever, :)
> >
> > anyway...
> >
> > i have, lets say...
> >
> > 1. 15 select elements on a page.
> > 2. each is named uniquely.
> > 3. all are filled with 1-15 as the values (indexes 0-14)
> > 4. if a user chooses, 14 in element 1 (index 0) i need to prevent them
> > from choosing 14 in ANY other element.
> >
> > i (think) i can do it with something sort of LONG and VERY unelegant
> inline
> > (this.selectedIndex==0){2.something.Whatever};"
> > onChange() event, but i think there has to be a BETTER way to do it.
> >
> > id love to learn this, is there a place to get this kind of _javascript_
> > learning?  ive picked up EVERY thing i can about a lot of web
> > programming languages, just cant crack the _javascript_ code...
> >
> > help ??? :)
> >
> > cheers.
> > --
> > tony
> >
> > Tony Weeg
> > human.
> > email: tonyweeg [at] gmail [dot] com
> > blog: http://www.revolutionwebdesign.com/blog/
> >
> > Check out http://www.antiwrap.com to send websites to your friends.
> >
> >
> >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to