Thanks TJ!

I had fixed the Stack Overflow problem around 6a this morning... I would
share what the problem was but then I'd have to kill my self! LOL

Thanks also for the short version of your setSelect(), I tried in vain to do
that for a full day... another example of how the prototype documentation
really sucks!  It should have been a 2 minute find/do.

Not gonna worry about the click handler because there are only 8 onclicks on
that page and I doubt a user will use more than 1 or 2 of them... if they
even realize those images work that way... just an easter egg is all it is.

On Thu, Oct 14, 2010 at 7:33 AM, T.J. Crowder <[email protected]>wrote:

> Hi,
>
> I'm not 100% sure what you're trying to do with all of those templates
> and that selector (the selector is invalid, looks like maybe you're
> trying to use a template in it, but it's all one big quoted string,
> so...). However, I _think_ you're trying to replicate the Prototype
> `Element#setValue` function. If I'm reading right, your `setSelect`
> could read like this:
>
> function setSelect(selID, strValue) {
>  $(selID).setValue(strValue);
> }
>
> Live example: http://jsbin.com/aboyo
>
> Perhaps off-topic, but I wouldn't have all of those onclicks if you
> can avoid it:
> http://jsbin.com/aboyo/2
>
> You can condense that a bit:
> http://jsbin.com/aboyo/3
>
> HTH, apologies if I've gotten the wrong end of the stick.
> --
> T.J. Crowder
> Independent Software Engineer
> tj / crowder software / com
> www / crowder software / com
>
> On Oct 14, 1:54 am, Phil Petree <[email protected]> wrote:
> > Hey All!
> >
> > In my html doc I have a series of images... one for aol, yahoo, gmail,
> > facebook etc. and each image in written like this:
> > <img src='images/aol.png' border='0' onclick='setSelect("thSelect",
> > "aol");'/>
> >
> > In my javascript file I have setSelect defined like this:
> > function setSelect(strID, strValue)
> > {
> >   var selectIDTemplate = new Template('#{matchID}');
> >   var selectTemplate = new Template('#{matchString}');
> >   var selectThis = {matchID: strID};
> >   var selectID = {matchString: strValue };
> >   $$('select#selectIDTemplate.evaluate(selectID)
> option').each(function(o){
> >     if(o.value == selectTemplate.evaluate(selectThis)){o.selected =
> > true;$break;}
> >   });
> >
> > }
> >
> > When I click on an image I get a "Stack Overflow on line 29" error.  This
> is
> > with prototype.js 1.6.1
> >
> > Any ideas? Suggestions?
> >
> > Thanks!
> >
> > Pete
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to