Erreur dans mes scripts Javascript

Résolu
jcbrinfo Messages postés 21 Statut Membre -  
jcbrinfo Messages postés 21 Statut Membre -
Voilà, j'aurais besoin de votre aide pour trouver mon erreur.
Fichiers >
list.htm:
<html><head>
<title></title>
<link rel="StyleSheet" href="theme.css" type="text/css" />
<script type="text/javascript" src="thumbs.js"></script>
</head><body>
<script type="text/javascript" src="lists.js"></script>
<script type="text/javascript" language"javascript">
createlist(0);
document.write(l);</script></body></html>


lists.js:
function createlist(listid)
{l=new files();
 if (listid==0)
 {l.nlist(1,'Images');}}


thumbs.js:
selectid='list0';
//Fichier
function file(url,name,thumb,size,cdate,gtype,type,ico,viewf,descrip)
{if(thumb==='')
 {thumb='thumbs/default.gif';}
 if(size==='')
 {size='(inconnue)';}
 if(cdate==='')
 {cdate='(inconnue)';}
 if(gtype==='')
 {gtype='none';}
 if(type==='')
 {type='(inconnu)';}
 if(ico==='')
 {ico='ico/default.gif';}
 if(viewf==='')
 {viewf=thumb;}
 if(descrip==='')
 {descrip='(aucune)';}
 this.url=url;
 this.name=name;
 this.thumb=thumb;
 this.size=size;
 this.cdate=cdate;
 this.gtype=gtype;
 this.type=type;
 this.ico=ico;
 this.viewf=viewf;
 this.descrip=descrip;
 this._p;}
//Redirection de liste
function list(rlistid,rlname)
{this.rlistid=rlistid;
 this.rlname=rlname;
 this._p;}
//Liste
function files(listname)
{this.listname=listname;
 this.filei=[];
 this.listi=[];}
 //Ajouter un fichier à la liste
files.prototype.nfile= function (url,name,thumb,size,cdate,gtype,type,ico,viewf,descrip)
{this.filei [this.filei.length]=file(url,name,thumb,cdate,type,ico,viewf,descrip);};
//Ajouter une redirection de liste à la liste
files.prototype.nlist= function (rlistid,rlname)
{this.listi[this.listi.length]=list(rlistid,rlname);};
//Créer le "body"
files.prototype.toString=function()
{var lbody='';
 var i=0;
 for(i=0;i<this.listi.length;i++)
 {lbody+='<div id="list'+i+'" class="thumb0"><center>';
  lbody+='<a href="javascrip:iselect(\'list'+i+'\');" ondblclick="parent.toc.afflist='+this.listi[i].rlistid+';parent.toc.d.s('+this.listi[i].rlistid+');createlist('+this.listi[i].rlistid+')"><img src="bfolder.png" width="128" height="128" border="1" name="img'+i+'"></a>';
  lbody+=this.listi[i].rlname+'</div>';}
  return lbody;};
function iselect(id)
{document.getElementById(selectid).className='thumb0';
 selectid=id;
 document.getElementById(selectid).className='thumb1';}


theme.css:
a:link
{color: rgb(0,0,200);
 text-decoration: none;}
a:hover
{color: rgb(0,128,255);
 text-decoration: underline;}
a:visited
{color: rgb(0,0,200);
 text-decoration: none;}
a:hover
{color: rgb(0,128,255);
 text-decoration: underline;}
a:active
{color: rgb(255,0,0);
 text-decoration: none;}
a.s
{color: rgb(0,128,64);
 text-decoration: none;
 font-weight: bold;
 font-size: 10pt;}
a:hover.s
{color: rgb(0,0,255);
 text-decoration: underline;
 font-weight: bold;
 font-size: 10pt;}
a:visited.s
{color: rgb(0,128,64);
 text-decoration: none;
 font-weight: bold;
 font-size: 10pt;}
a:hover.s
{color: rgb(0,0,255);
 text-decoration: underline;
 font-weight: bold;
 font-size: 10pt;}
a:active.s
{color: rgb(128,0,0);
 text-decoration: none;
 font-weight: bold;
 font-size: 10pt;}
body
{color: rgb(0,0,0);
 background-color: rgb(255,255,255);
 font-family: Arial, Arial, Helvetica;}
h1
{color: rgb(128,128,128);
 font-family:  Arial, Arial, Helvetica;
 font-style: normal;}
h2, marquee
{color: rgb(100,100,100);
 font-family: Arial, Arial, Helvetica;
 font-style: normal;}
h3
{color: rgb(80,80,80);
 font-family: Arial, Arial, Helvetica;
 font-style: normal;}
h4
{color: rgb(60,60,60);
 font-family: Arial, Arial, Helvetica;
 font-style: normal;}
h5
{color: rgb(40,40,40);
 font-family: Arial, Arial, Helvetica;
 font-style: normal;}
h6
{color: rgb(0,0,0);
 font-family: Arial, Arial, Helvetica;
 font-style: normal;}
thumbs0
{position:relative;
 width:130px;
 padding:1px 1px 1px 1px;
 background-color:#FFFFFF;
 border-color: rgb(0,0,192);
 border-width:1px;
 border-style:solid;}
thumbs1
{position:relative;
 width:130px;
 padding:1px 1px 1px 1px;
 background-color:#0000FF;
 border-color: rgb(0,0,192);
 border-width:1px;
 border-style:solid;}


Fichier principal > list.htm
Contexte habituel > Dans un frame.
Résultat souaité > une vignette cliquable + un petit texte
Resultat obtenu> Rien.
Erreur affiché avec Console2 > Erreur : Component returned failure code: 0x8007000e (NS_ERROR_OUT_OF_MEMORY) [nsIDOMNSHTMLDocument.write]
Fichier source : list.htm
Ligne : 9

2 réponses

Dalida Messages postés 7114 Date d'inscription   Statut Contributeur Dernière intervention   923
 
salut,

un dépassement de capacité, regarde du côté de la boucle 'for' en fin de thumbs.js.
essaie en l'enlevant.
0
jcbrinfo Messages postés 21 Statut Membre
 
Pourtant, il n'y a qu'un élément. Deplus, console2 parle plutôt d'un dépassement de capacité dans document.write.
0
jcbrinfo Messages postés 21 Statut Membre
 
J'ai essayé.
Même erreur.
0
jcbrinfo Messages postés 21 Statut Membre
 
Je crois avoir trouvé! Ma deuxième ligne dans la boucle for est trop longue (fonctionne avant, mais pas après cette ligne).
0
jcbrinfo Messages postés 21 Statut Membre
 
J'ai fait quelque chose de complètement différent et cela fonctionne.
0