Sto scrivendo una piccola chat, utilizzando mootools, funziona perfettamente su Firefox, tuttavia su IE7 quando nella pagina .php cerco di richiamarla mi dice Chat non definita.
file chat.js
nel file php chat.php viene istanziata con la seguente funzione:codice:var Chat = new Class({ initialize: function(usr,usr_to){ (cut) }, getMessage: function(msglog){ if (!msglog){ msglog=false; } var url = 'ajax/message.php'; var myAjax = new Ajax(url, { method: 'post', data: Object.toQueryString({ usr_to: this.usr_to , i: this.last_poolid }), onComplete: function(txt,xml){ msg = Json.evaluate(txt); if (!$chk(msg)){ return false; } el = $('message'); for (var i = 0; i<msg.length; i++){ el_row = new Element('div', { class: 'msg_row' }); el_row_usr = new Element('div', { class: 'msg_usr' }); el_row_usr.setHTML(msg[i]['cht_from'] +':'); el_row_msg = new Element('div', { class: 'msg_msg' }); el_row_msg.setHTML(msg[i]['cht_msg']); el_row_usr.injectInside(el_row); el_row_msg.injectInside(el_row); el_row.injectInside(el); this.last_poolid=msg[i]['cht_id']; } }.bind(this) }); myAjax.request(); }
La cosa bella è che togliendo il blocco "var myAjax = new Ajax(url, {..." la classe viene vista.codice:window.addEvent('domready', function(){ cht = new Chat('<?= $usrname ?>', '<?= $usr_to ?>'); });
cosa c'è di sbagliato ho dimenticato qualcosa sulla gestione degli oggetti in js da parte di IE?

Rispondi quotando