Hi Loris, I think that your trouble is normal, because IE don't allow to instantiate method on native object. Generally it's not a good idea to extend native objects because your not sure that another JS will not use the same method name !!
-- david On 19 déc, 00:36, Loris <loris.men...@gmail.com> wrote: > hello, sorry for my bad English. > I try to explain: > > I try to instantiate a class when the page loads, but when I happened > on most browsers, I can not do it in Internet Explorer 7 or 6 > > I call the script in my template, like this: > > <script type="text/javascript" src="/js/veicoli-random.class.js"></ > script> > > <script type="text/javascript"> > > new VeicoliRandom('wrap-cont_veicoli_random', > 'cont_veicoli_random', '{$url_pagina}'); > > </script> > > And the script contains: > > Random = Class.create(); > > Random.prototype = { > > wrap : null, > nomeWrap : null, > container : null, > nomeContainer : null, > url : null, > > initialize : function(wrap, container, url) > > { > this.wrap = $(wrap); > this.nomeWrap = wrap; > > this.container = $(container); > this.nomeContainer = container; > this.url = url; > > if ( this.url == '' ) > this.url = '/'; > > if (!this.container || !this.wrap) > > return; > > this.arrotola.bind(this).delay(10); > > }, > > arrotola : function() > { > // nascondo la scritta sold, per IE > var ElementiNIE = $$('#' + this.nomeContainer + ' > div.timbro-venduto- > random'); > ElementiNIE.each( function(div) { > div.addClassName('invisibileIE'); > }); > > // arrotolo su > Effect.BlindUp(this.wrap, { duration: 3 }); > this.aggiorna.bind(this).delay(5); > }, > > aggiorna : function () > { > // aggiorno > var options = {onComplete : this.srotola.bind(this).delay(1)}; > new Ajax.Updater(this.container, this.url, options); > }, > > srotola : function() > { > this.wrap.setStyle({ display: 'none' }); > // srotolo giù > Effect.BlindDown(this.wrap, { duration: 3 }); > this.arrotola.bind(this).delay(15); > }, > > }; > > Object.extend(document, { > isDocReady: false, > isDocLoaded: false, > ready: function(fn) { Event.observe(document, "doc:ready", fn); }, > load: function(fn) { Event.observe(document, "doc:loaded", fn); }}); > > Event.observe(document, "dom:loaded", function() { > Event.fire(document, "doc:ready"); > document.isDocReady = true; > if (document.isDocLoaded) > Event.fire(document, "doc:loaded");}); > > Event.observe(window, "load", function() { > document.isDocLoaded = true; > if (!document.isDocReady) return; > Event.fire(document, "doc:loaded"); > > }); > > // fa partire la vera classe al load della pagina > VeicoliRandom = Class.create(); > > VeicoliRandom.prototype = { > > initialize : function(wrap, container, url) > > { > > // Event.observe(window, 'load', new Random(wrap, container, > url)); > //document.observe('dom:loaded', new Random(wrap, container, > url)); > document.load( a = new Random(wrap, container, url) ); > > }, > > }; > > I can not understand why the class called "random" is not instantiated > or otherwise IE does nothing. > While with fire-fox or other browsers, seems to work properly. > What could be my mistake? > > Thank you for your attention. > Regards Loris -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.