for loop doesn`t work fine on Firefox

M

MZ

Hello!

The following js code doesn`t work fine on Firefox and I don`t know why.
I have table with 30 rows and on IE I click once on analyse button and it
fills my cells automaticaly, but
when I click the same analyse button on Firefox it fills me only one row and
force me to click 30 times to fill the whole table.

I replaced js break; into js continue; but it didn`t help me.

Could you help me fix the problem?
Marcin

<input type="button" value="Analizuj" name="analizuj" class="btn"
id="analizuj"
onClick="analiza_na_podstawie_poprzedniego_tygodnia('form_nowe_notowanie');">

---------------------------------------------------------------------------------------------------


for (var
m=1;m<=parseInt(document.getElementById('ilosc_pozycji_juz_wygenerowanych').value);m++)
{
if (document.getElementById('notowanie_szacowane').value=='T')
{
document.getElementById('pozycja_poprzednia_new'+m).value=document.getElementById('pozycja_aktualna_new'+m).value;
}

if
((parseInt(document.getElementById('pozycja_poprzednia_new'+m).value)!=0) &&
(document.getElementById('artysta_new'+m).value=='') &&
(document.getElementById('utwor_new'+m).value==''))
{
for
(n=1;n<=document.getElementById('ilosc_pozycji_juz_wygenerowanych_old').value;n++)
{
krotnosc_ilosc=0;
for
(v=1;v<=parseInt(document.getElementById('ilosc_pozycji_juz_wygenerowanych_old').value);v++)
{
if (document.getElementById('notowanie_szacowane_old').value=='T')
{
if
(document.getElementById('pozycja_poprzednia_old'+n).value==document.getElementById('pozycja_poprzednia_old'+v).value)
{
krotnosc_ilosc=krotnosc_ilosc+1;
}
}
else
{
if
(document.getElementById('pozycja_aktualna_old'+n).value==document.getElementById('pozycja_aktualna_old'+v).value)
{
krotnosc_ilosc=krotnosc_ilosc+1;
}
}
}

if (
(
(document.getElementById('notowanie_szacowane_old').value!='T') &&
(parseInt(document.getElementById('pozycja_aktualna_old'+n).value)==parseInt(document.getElementById('pozycja_poprzednia_new'+m).value))
)
||
(
(document.getElementById('notowanie_szacowane_old').value=='T') &&
(parseInt(document.getElementById('pozycja_poprzednia_old'+n).value)==parseInt(document.getElementById('pozycja_poprzednia_new'+m).value))
)
)
{


if (krotnosc_ilosc==1)
{
if (m>1)
{
if
((document.getElementById('utwor_old'+n).value!=document.getElementById('utwor_new'+(m-1)).value)
||
(document.getElementById('artysta_old'+n).value!=document.getElementById('artysta_new'+(m-1)).value))
{
document.getElementById('utwor_new'+m).value=document.getElementById('utwor_old'+n).value;
document.getElementById('artysta_new'+m).value=document.getElementById('artysta_old'+n).value;
if (document.getElementById('butt').value!='Aktualizuj dane')
{
document.getElementById('id_new_old'+m).value=document.getElementById('id_old'+n).value;
document.getElementById('artysta_new_old'+m).value=document.getElementById('artysta_old'+n).value;
document.getElementById('utwor_new_old'+m).value=document.getElementById('utwor_old'+n).value;
}
}
}
else
{
document.getElementById('utwor_new'+m).value=document.getElementById('utwor_old'+n).value;
document.getElementById('artysta_new'+m).value=document.getElementById('artysta_old'+n).value;
if (document.getElementById('butt').value!='Aktualizuj dane')
{
document.getElementById('id_new_old'+m).value=document.getElementById('id_old'+n).value;
document.getElementById('artysta_new_old'+m).value=document.getElementById('artysta_old'+n).value;
document.getElementById('utwor_new_old'+m).value=document.getElementById('utwor_old'+n).value;
}
}

continue;
}
else
{
if (confirm("Czy chcesz dodac do pozycji
"+document.getElementById('pozycja_aktualna_new'+m).value+ " :
"+document.getElementById('artysta_old'+n).value+" -
"+document.getElementById('utwor_old'+n).value+" ?"))
{
if (m>1)
{
if
((document.getElementById('utwor_old'+n).value!=document.getElementById('utwor_new'+(m-1)).value)
||
(document.getElementById('artysta_old'+n).value!=document.getElementById('artysta_new'+(m-1)).value))

{
document.getElementById('utwor_new'+m).value=document.getElementById('utwor_old'+n).value;
document.getElementById('artysta_new'+m).value=document.getElementById('artysta_old'+n).value;
continue;
if (document.getElementById('butt').value!='Aktualizuj dane')
{
document.getElementById('id_new_old'+m).value=document.getElementById('id_old'+n).value;
document.getElementById('artysta_new_old'+m).value=document.getElementById('artysta_old'+n).value;
document.getElementById('utwor_new_old'+m).value=document.getElementById('utwor_old'+n).value;
}

}
}
else
{
document.getElementById('utwor_new'+m).value=document.getElementById('utwor_old'+n).value;
document.getElementById('artysta_new'+m).value=document.getElementById('artysta_old'+n).value;
continue;
if (document.getElementById('butt').value!='Aktualizuj dane')
{
document.getElementById('id_new_old'+m).value=document.getElementById('id_old'+n).value;
document.getElementById('artysta_new_old'+m).value=document.getElementById('artysta_old'+n).value;
document.getElementById('utwor_new_old'+m).value=document.getElementById('utwor_old'+n).value;
}
}
}
else
{
alert("Pozycja nie zostala dodana");
}
}

}
}

}

}
 
K

K.

Uzytkownik "Randy Webb said:
MZ said the following on 4/23/2007 4:18 PM:

Post a URL to a page so it can be viewed. Without seeing the accompanying
HTML it is impossible to tell. And, I can not speak for anyone else, but I
don't care to try to guess what the HTML looks like to try to debug that
script.

--

Please take a look at:

http://www.zmyslowski.pl/MZ_CRM/

login: user
passw: test123

Then you have to go to the following links:

Lista Przebojow->Lista Przebojow Programu III Polskiego Radia (1-30)-> Dodaj
nowe notowania->
then click on "Tworz liste" and then please fill "POZ. -7" column on the
right table. Please fill this column by typing 1 for "Poz. akt." = 1,
2 for "Poz. akt" = 2. and so on till 30.

So it will look like:

Poz. akt Poz -7 Artysta Utwor
1 1
2 2
3 3
..... ...
30 30

After clicking on "Analizuj" button it should works the same as on IE that
is:
Poz. -7 on the right table should read Poz. akt from the left table and
after reading
it should fill Artysta & Utwor columns automaticaly.

I hope I will explain you fine what I mean.

Thank you in advance for help
Marcin
 
L

-Lost

K. said:
Please take a look at:

http://www.zmyslowski.pl/MZ_CRM/

login: user
passw: test123

Then you have to go to the following links:

Lista Przebojow->Lista Przebojow Programu III Polskiego Radia (1-30)-> Dodaj
nowe notowania->
then click on "Tworz liste" and then please fill "POZ. -7" column on the
right table. Please fill this column by typing 1 for "Poz. akt." = 1,
2 for "Poz. akt" = 2. and so on till 30.

So it will look like:

Poz. akt Poz -7 Artysta Utwor
1 1
2 2
3 3
.... ...
30 30

After clicking on "Analizuj" button it should works the same as on IE that
is:
Poz. -7 on the right table should read Poz. akt from the left table and
after reading
it should fill Artysta & Utwor columns automaticaly.

I hope I will explain you fine what I mean.

document.getElementById("butt") has no properties
http://www.zmyslowski.pl/MZ_CRM/index.php?id_page=lp&subtytul=lp3_1_30&subtytul2=dodajnowalp
Line 111
Thank you in advance for help

Sure. Now teach me Polish.
 
L

-Lost

-Lost said:
document.getElementById("butt") has no properties
http://www.zmyslowski.pl/MZ_CRM/index.php?id_page=lp&subtytul=lp3_1_30&subtytul2=dodajnowalp

Line 111


Sure. Now teach me Polish.

Oops, I pasted the wrong thing.

I think you are running into problems in your using parseInt on
"losc_pozycji_juz_wygenerowanych" and several other FORM element values
that you retrieve via getElementById.

It appears to be a FORM element which could easily be retrieved from a
collection.

I think you need to reevalute
"analiza_na_podstawie_poprzedniego_tygodnia." I cannot possibly tell
why you have so much code to iterate values from one side of the page to
a collection of FORM INPUTs anyway.
 
K

K.

Uzytkownik "-Lost said:
Oops, I pasted the wrong thing.

I think you are running into problems in your using parseInt on
"losc_pozycji_juz_wygenerowanych" and several other FORM element values
that you retrieve via getElementById.

It appears to be a FORM element which could easily be retrieved from a
collection.

I think you need to reevalute
"analiza_na_podstawie_poprzedniego_tygodnia." I cannot possibly tell why
you have so much code to iterate values from one side of the page to a
collection of FORM INPUTs anyway.


I have checked. Now everything work fine. It was a problem with
getElementById.
I had to change if php to show input field.

Thanks for help
Marcin
 
L

-Lost

K. said:
I have checked. Now everything work fine. It was a problem with
getElementById.
I had to change if php to show input field.

Thanks for help

Not a problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top