rss
Rechercher : dans
Par : Pertinence Date Nom d'utilisateur
Statut : Non résolu

[Javascript] marche sous IE pas sous Firefox?

  Posté par genepi, le samedi 3 mars 2007 à 13:19:30
javascript ne fonctionnant pas sous firefox ?

j'ai ce code qui fonctionne sous IE mais pas sous Firefox
a votre avis ou est l'erreur ?

<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT>
// 31-10-2003 - francktfr@systeme-d.net
// écrit pour http://www.systeme-d.net

var Blocs = new Array()

var Sentence = new Array()
Sentence.push("Bienvenue a l'UCP !")
Sentence.push("Union Cycliste de Poncharra")
Sentence.push("www.ucpontcharra.net")
Blocs.push(Sentence)

Sentence = new Array()
Sentence.push("Reunion du club :")
Sentence.push("mardi 13 avril a 19h")
Sentence.push("venez nombreux !!!!")
Blocs.push(Sentence)

Sentence = new Array()
Sentence.push("")
Sentence.push("Bon velo a tous.")
Sentence.push("")
Blocs.push(Sentence)

var iDones = new Array() // Tableau des caracteres placés
var TotalDone = 0 // Total des caracteres placés
var RowSpeed = 700 // Interval entre rangée (ms)
var ColSpeed = 100 // Interval entre colonne (ms)
var BlockSpeed = 1000 // Temps d'affichage de bloc de texte (ms)
var LenX = 0 // Nombre de colonnes
var LenY = 0 // Nombre de rangées
var CodeLetter = new Array() // Tableau des symboles HTML

//function Init(){
for (i=32; i<255; i++){
if (i<127 || i>160)
CodeLetter.push(String.fromCharCode(i))
} // Remplissage du tableau
//}



// Cree un chaine avec que des " "
function Str(Len){
var Result = ""
for (s=1; s<=Len; s++){
Result += " "
}
return(Result)
}



// verification des phrases + mise a la bonne dimension et dimensions du tableau
function CheckLetters(){
var msg = ""
for (i=0; i<Blocs.length; i++){
if (LenY < Blocs[i].length){
LenY = Blocs[i].length
}
for (j=0; j<Blocs[i].length; j++){
for (a=0; a<Blocs[i][j].length; a++){
var isin = 0
for (c=0; c<CodeLetter.length; c++){
if(CodeLetter[c] == Blocs[i][j].charAt(a)){
isin = 1; break
}
}
if(!isin){
msg += Blocs[i][j][a] + " inconnu \n"
}
}
if (LenX < Blocs[i][j].length){
LenX = Blocs[i][j].length
}
}
}
if(msg != ""){
alert(msg); return(0)
}
for (i=0; i<(LenX*LenY); i++){
iDones.push(0)
}
// Remplissage des lignes et caracteres manquants
var diff = 0
for (i=0; i<Blocs.length; i++){
for (j=0; j<Blocs[i].length; j++){
diff = LenX-Blocs[i][j].length
if (diff){
Blocs[i][j] += Str(diff)
} // Complete le reste de la chaine
}
diff = LenY-Blocs[i].length
if (diff){
for (j=0; j<diff; j++) {
Blocs[i].push(Str(LenX))
}
} // creation d'une nouvelle chaine
}
return(1)
}



function InitPanel(Container){
// Init()
if (!CheckLetters()){
return(0)
}
// Création du tableau HTML
var table = "<TABLE CELLPADDING=0 CELLSPACING=1 CLASS=Panel>\n"
for (j=0; j<LenX; j++){
table += "<COL WIDTH=13>"
}
for (i=0; i<LenY; i++){
table += "<TR>"
for (j=0; j<LenX; j++){
table += "<TD HEIGHT=18 ID=AF_"+i+"_"+j+" CLASS=PanelCell> </TD>"
}
table += "</TR>"
}
table += "</TABLE>"
Container.innerHTML = table
WriteBlock(0)
}



// Retourne L'index du caractere
function CodeIndex(car){
var res = CodeLetter.length
for (i=0; i<CodeLetter.length; i++){
if (car == CodeLetter[i]){
return(i)
}
}
return(0)
}



// Passage au prochain bloc de phrases ou au premier
function NextBlock(BlockIndex){
if (BlockIndex < (Blocs.length-1)){
BlockIndex++}
else{BlockIndex=0}
WriteBlock(BlockIndex)
}



// Lance l'ecriture des phrases
function WriteBlock(i){
for (a=0; a<(LenX*LenY); a++){
iDones[a]=0
}
TotalDone = 0
for (r=0; r<Blocs[i].length; r++){
setTimeout("WriteRow("+i+", "+r+")",r*RowSpeed)
}
}



// Lance l'ecriture des lettres
function WriteRow(BlockIndex, RowIndex){
for (l=0; l<Blocs[BlockIndex][RowIndex].length; l++){
var start = CodeIndex(document.getElementById("AF_"+RowIndex+&­quot;_"+l).innerText)
//eval("var start = CodeIndex(AF_"+RowIndex+"_"+l+".innerTex­t)")
setTimeout("WriteLetter("+BlockIndex+", "+RowIndex+","+l+","+start+")&­quot;,l*ColSpeed)
}
}



function WriteLetter(BlockIndex, RowIndex, LetterIndex, CodeIndex){
if (!iDones[(LenX*RowIndex)+(LetterIndex)]) {
var Cel = document.getElementById("AF_"+RowIndex+"_&quo­t;+LetterIndex)
//eval("var Cel = AF_"+RowIndex+"_"+LetterIndex)
if (Blocs[BlockIndex][RowIndex].charAt(LetterIndex) == CodeLetter[CodeIndex]){
iDones[(LenX*RowIndex)+(LetterIndex)]++
TotalDone++
if (TotalDone >= (LenX*LenY)){
setTimeout("NextBlock("+BlockIndex+")&quo­t;,BlockSpeed)
}
}
Cel.innerText = CodeLetter[CodeIndex]
CodeIndex < CodeLetter.length-1 ? CodeIndex++ : CodeIndex = 0
setTimeout("WriteLetter("+BlockIndex+", "+RowIndex+", "+LetterIndex+","+CodeIndex+")",10)­
}
}

</SCRIPT>

<STYLE>
.Panel {
background:#000000 none repeat scroll 0%;
color:#FF0000;
font-family:Courier;
font-size:14px;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:normal;
table-layout:fixed;
text-align:center;
}
.PanelCell {
background:#111111 none repeat scroll 0%;
vertical-align:middle;
}
</STYLE>
<!--STYLE>
.Panel {FONT: 14 Courier; COLOR: #FF0000; TABLE-LAYOUT: fixed; TEXT-ALIGN: center; BACKGROUND: #000000}
.PanelCell {VERTICAL-ALIGN: middle; BACKGROUND: #111111}
</STYLE -->

</HEAD>

<BODY ONLOAD="InitPanel(document.getElementById('dtable'))&qu­ot;>

<script type="text/javascript">
<!--
if (navigator.appName == "Microsoft Internet Explorer")
{document.write("<DIV id=dtable></DIV><br>Panneau d'affichage Internet Explorer");}
else
{document.write("<DIV id=dtable></DIV><br>Panneau d'affichage Mozilla");}
//-->
</script>

</BODY>
</HTML>
Configuration: Windows XP
Firefox 2.0.0.2
Répondre à genepi  Signaler ce message aux modérateurs
Logiciels pertinents trouvés dans les téléchargements
Télécharger Web Developer Toolbar 1.1.6Web Developer Toolbar - WebDeveloper est une extension firefox représentant une formidable boîte à outils pour examiner et manipuler les pages...Catégorie: Extensions Firefox
Licence: Freeware/gratuit
Télécharger Firefox 3.0.1Firefox - Mozilla Firefox 3 est un excellent navigateur qui peut fonctionner à côté d' Internet Explorer ou le remplacer. Il...Catégorie: Navigateurs
Licence: Open Source
Télécharger Google Toolbar pour Firefox 3Google Toolbar pour Firefox - La barre d'outils Google permet : d'afficher le pagerank des pages visitées d'ajouter à vos favoris les pages que vous...Catégorie: Référencement
Licence: Freeware/gratuit
Télécharger Toutes les extensions (petits modules complémentaires) de Firefox ?Toutes les extensions (petits modules complémentaires) de Firefox - Au lieu d'énumérer toutes les extensions (petits modules complémentaires) de Fire fox , allez dans le menu outils de...Catégorie: Extensions Firefox
Licence: Freeware/gratuit
Plus de logiciels gratuits sur « [Javascript] marche sous IE pas sous Firefox? »