Il problema e` nella variabile tot: ponendo il caso che valnum valga 100, il risultato e` 10025 e non 125. Avviene una concatenazione invece di una somma.. 'ndo sbaglio?
codice:var click=0, offset=25, x=0; function scrollmenu() { resetmenu(); if (click == 0) { for (i = 2; i <= 14; i++) { x=eval("document.getElementById(menu[i]).style.top"); if (x.length == 4) { num = x.substring(0,2); } else { num = x.substring(0,3); } var valnum = num.valueOf(); tot = valnum + offset; // window.alert(tot); document.getElementById(menu[i]).style.top = tot; click=1; } } else { click=0; } }

Rispondi quotando