Witam!
Stworzyłem sobie skrypt na powiadamianie użytkownika co wypełnił źle w formularzu. W
FF,
Chrome oraz
Safari wszystko działa więc żeby nie było za kolorowo
IE postanowił być inny. Podaje adres do strony byście zobaczyli o co mi chodzi. Wejdźcie na niego z
FF i
IE (najlepiej kliknąć create by od razu zobaczyc efekt).
IE nie wywala żadnych błędów więc pomysły mi się skończyły ;/ btw. używam IE 8
Adres strony:
KLIKfunction AddSpan(spanID, tresc, poziom, posx, posy){
if(document.getElementById(spanID)){
return true;
}
var el = document.createElement("span");
el.setAttribute("id", spanID);
el.setAttribute("onclick", "this.style.display='none';document.getElementById('"+spanID+"').parentNode.removeChild(document.getElementById('"+spanID+"'));");
el.innerHTML=tresc;
if(poziom == 3)
el.style.background="url(alert3.png) no-repeat";
if(poziom == 2)
el.style.background="url(alert2.png) no-repeat";
if(poziom == 1)
el.style.background="url(alert1.png) no-repeat";
el.style.width="250px";
el.style.height="43px";
el.style.display="none";
el.style.position="absolute";
el.style.textAlign="center";
// przezroczystosc
el.style.opacity="0.0";
if(navigator.appName!="Netscape")
el.style.filter = "alpha(opacity=00)";
// -----------------
el.style.top=posy;
el.style.left=posx;
document.getElementsByTagName("form")[0].appendChild(el);
pulse(spanID);
}
function pulse(el){
document.getElementById(el).style.display="block";
for(var i=0;i<=9;i++)
setTimeout("setOpacity('"+el+"', "+i+")", 50*i);
if(document.getElementById(el)){
var j=0;
setTimeout(function(){
for(var k=9;k>=0;k--){
if(!document.getElementById(el)) return;
setTimeout("setOpacity('"+el+"', "+k+")", 40*j);
j++;
}
}, 4000);
setTimeout(function(){
if(!document.getElementById(el)) return;
document.getElementById(el).style.display="none";
document.getElementById(el).parentNode.removeChild(document.getElementById(el));
}, 4500);
}
}
function setOpacity(id, value) {
if(!document.getElementById(id)) return;
id = document.getElementById(id);
id.style.opacity = value/10;
id.style.filter = 'alpha(opacity=' + value*10 + ')';
}