La div adesso compare in modo corretto dopo 3sec;
ora ho un codice che crea una funzione per un effetto fadeIn.
codice:
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart < opacEnd) {
for(i = opacStart; i <= opacEnd; i++)
{
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
}
}
Il codice viene richiamato cosi
<body onLoad="javascript
pacity('FadeIn', 0, 100, 1500)" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
in questo modo, però non funziona in modo corretto.
Posso applicare onload solo al div e non al body della pagina?