Valeur disparait & instruction non executé

cs_Zeroc00l Messages postés 367 Date d'inscription lundi 1 avril 2002 Statut Membre Dernière intervention 11 février 2010 - 1 avril 2007 à 15:58
cs_Zeroc00l Messages postés 367 Date d'inscription lundi 1 avril 2002 Statut Membre Dernière intervention 11 février 2010 - 2 avril 2007 à 02:09
Voici le code :

<div id="FAVOREE_content"/><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /??>

 

<script type="text/javascript">

 

        ///////////////////////////////////

        // Class "Item"

        ///////////////////////////////////

 

        function Item(unique, depth)

        {

                       this.id = unique;

                       this.depth = depth;

                       this.caption = "";

        }

        Item.prototype.Import = function(str)

        {

                       this.caption = str;

                       alert('ECRITURE : caption = "' + this.caption + '"');

        };

        Item.prototype.to_HTML = null;

 

 

 

        ///////////////////////////////////

        // Class "Favori" extends "Item"

        ///////////////////////////////////

 

        Favori.prototype = new Item();

        Favori.prototype.constructor = Favori;

 

        function Favori(unique, depth)

        {

                       Item.call(this, unique, depth);

                       this.url = "";

        }

        Favori.prototype.Import = function(str)

        {

                       Item.prototype.Import("Yahoo");

                       alert('APRES ECRITURE : Favori.caption = "' + this.caption + '"');

                       this.url = "www.yahoo.fr"

        };

 

        Favori.prototype.to_HTML = function()

        {

                       alert('Lecture Favori.caption = "' + this.caption + '"');

        };

 

 

 

        ///////////////////////////////////

        // Class "Folder" extends "Item"

        ///////////////////////////////////

 

        Folder.prototype = new Item();

        Folder.prototype.constructor = Folder;

 

        function Folder(unique, depth)

        {

                       Item.call(this, unique, depth);

                       this.children = new Array;

        }

        Folder.prototype.Import = function(str)

        {

                       Item.prototype.Import(str);

                       alert('APRES ECRITURE : Folder.caption = "' + this.caption + '"');

                       var favori = new Favori(this.unique + "_1", this.depth + 1);

                       favori.Import("Yahoo");

                       this.children.push(favori);

        };

        Folder.prototype.to_HTML = function()

        {

                       alert('Lecture Folder.caption = "' + this.caption + '"');

                       this.children[0].to_HTML();

        };

 

 

        var root = new Folder("item", 0);

        root.Import("Root"); // Va creer les valeurs

        root.to_HTML();  // va les lire

 

</script>

 

le probleme : Pourquoi les alert("LECTURE ...") affiche des valeur de caption vide ?

-={[ Zeroc00l ]}=-

3 réponses

cs_Zeroc00l Messages postés 367 Date d'inscription lundi 1 avril 2002 Statut Membre Dernière intervention 11 février 2010
1 avril 2007 à 16:00
Le preview window ne marche trop pas !
J'avais colore bien comme il faut le code, le previex m'avait montre la meme chose 
et la l'affichage est monstrueux !

-={[ Zeroc00l ]}=-
0
stfou Messages postés 450 Date d'inscription samedi 16 avril 2005 Statut Membre Dernière intervention 18 avril 2007 3
1 avril 2007 à 16:57
Amical Bonjour à toi aussi ! (comme dirait bultez ;) ) Ensuite il n'y a pas de alert("LECTURE"). et explique clairement ton problème.

<hr /><hr />
Stfou
0
cs_Zeroc00l Messages postés 367 Date d'inscription lundi 1 avril 2002 Statut Membre Dernière intervention 11 février 2010
2 avril 2007 à 02:09
Favori.prototype.to_HTML = function()
{
alert('Lecture Favori.caption = "' + this.caption + '"');
};


Serait ces les majuscules qui t'aurait trompé :)
0
Rejoignez-nous