@Allen, Alexander, Rainer, Again, can we please pick this up over on the appropriate group[1]?
[1] http://groups.google.com/group/prototype-scriptaculous Cheers, -- T.J. Crowder tj / crowder software / com On Aug 27, 2:50 pm, Rainer Weber <clicforw...@googlemail.com> wrote: > Hello, > thanks for this. But it dos nothing. > > I tried: > > document.observe("dom:loaded", function() { > $('german').observe('change', function() { > $('language1').replace('this is the german text'); > }); > > }); > > I want to change the text of a headline from englisch to german when i > choose german in the select menue. > > <select name="select" id="dog"> > <optgroup> > <option>Select Language</option> > <option id="englisch">Englisch</option> > <option id="german">German</option> > </optgroup> > </select> > > <h2 id="language1>Shop Gmund Professional Site</h2> > Geets > Rainer > > > > > > On Thu, Aug 27, 2009 at 3:10 PM, Allen Madsen <bla...@gmail.com> wrote: > > Hi, > > You probably want something more like this: > > <script type="text/javascript"> > > > document.observe("dom:loaded", function() { > > $('englisch').observe('change', function() { > > $('div').replace('<p>This is English</p>'); > > } > > }); > > </script> > > > The first problem is that you used # which is unneeded because $ assumes > > the value is an ID. The second is that you were observing the wrong event. > > You probably only want to make the change once the select has changed and > > the 'change' event will do that for you. The last thing I changed is > > switching to using observe instead of directly setting the onWhatever > > property. This is the preferred way of doing things in prototype. > > > For future reference, this isn't the place to post questions like this. > > Instead, go tohttp://groups-beta.google.com/group/prototype-scriptaculous > > > Allen Madsen > >http://www.allenmadsen.com > > > On Thu, Aug 27, 2009 at 8:01 AM, clicforw...@googlemail.com < > > clicforw...@googlemail.com> wrote: > > >> Hello, > > >> I need to change content of a dom element on select a option. > >> I tried to handel it like this: > > >> <script type="text/javascript"> > > >> document.observe("dom:loaded", function() { > >> $('#englisch').onfocus = function() { > >> $('div').replace('<p>This is English</p>'); > >> } > >> }); > >> </script> > > >> <select name="select"> > >> <optgroup> > >> <option>Select Language</option> > >> <option id="englisch">Englisch</option> > >> <option id="german">German</option> > >> </optgroup> > > >> But nothing happens. > >> Can anyone help me out? > > >> Thanks! > > -- > > ------------------------------------------------------------- > Rainer Weber > KOMMA-D > Agentur für Kommunikationsdesign > > Manggasse 6 > D-85049 Ingolstadt > > Tel.: +49 (0)841-1 29 47 60 > Fax: +49 (0)841-1 29 47 63 > Mobil: +49 (0)179-1 30 55 12 > rai...@komma-d.dewww.komma-d.de > ------------------------------------------------------------- > Bitte beachten! > Unsere E-Mail Adressen haben sich geändert. > Bitte verwenden Sie zukünftig die hier genannte Adresse. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---