<div id="FAVOREE_content"/>
<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 ?