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].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.