Hi Cristisor,

I think that what are u seeking is more or less this code:

<span id="birthdate_smarty_select">
<select id="day">
    <option value="0" selected>1990</option>
    <option value="1">1998</option>
    <option value="2">2000</option>
</select>

<select id="year">
    <option value="0">1990</option>
    <option value="1">1995</option>
    <option value="2" selected>1998</option>
</select>
</span>

<script type="text/javascript">
field = 'birthdate_smarty_select';
for(var i=0;i<$(field).childNodes.length;i++){
    if($(field).childNodes[i].tagName == "SELECT") {
        $(field).childNodes[i].selectedIndex = 0;
    }
}
</script>

So, pay attention on index of childNodes (i) not always be 1 and 2 because
this I think its good do a FOR of all elements inside of SPAN and verify if
that element is a SELECT, if is put the value 0 using selectedIndex
statement, if not dont do anything.
I test this issue on Firefox and  IE 7 and works great.

Regards,

Luiz Paulo


On Fri, Sep 19, 2008 at 7:38 AM, Cristisor <[EMAIL PROTECTED]> wrote:

>
> Hi everyone. I have a small problem with IE. I have a span with the
> id="birthdate_smarty_select' and inside there are 2 "select" fields,
> one for day and the other one for year. I'm trying to set the default
> for the first value in both select fields like this:
> $(field).childNodes[1].selectedIndex = 0;
> $(field).childNodes[2].selectedIndex = 0;where
> field=birthdate_smarty_select
> it works just fine in FF but it won't work in IE :(
> >
>


-- 
Luiz Paulo Camargo

--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
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